Valid in: | DATA step |
Category: | File-handling |
Type: | Executable |
See: | FILE Statement under Windows , UNIX , and z/OS |
infile dummy ftp user='myuid' pass='xxxx' filevar=file_to_read;
The delimiter is case sensitive.
If you specify RECFM=N, make sure that the LRECL is large enough to hold the largest input item. Otherwise, it might be possible for the delimiter to be split across the record boundary.
DATA _NULL_; FILE log dsd; x='"lions, tigers, and bears"'; put x ' "Oh, my!"'; run;
DATA _NULL_; FILE log dsd; PUT 'lions, tigers, and bears'; run;
Use a LENGTH statement to make the variable length long enough to contain the value of the physical filename if the variable length is longer than eight bytes (the default length of a character variable).
If any of the physical filenames is longer than eight bytes (the default length of a character variable), assign the FILEVAR= variable a longer length with another statement, such as a LENGTH statement or an INPUT statement.
Use the HEADER= option only when you write to print files.
The value of the LINE= variable is set at the end of PUT statement execution to the number of the next available line.
Do not use the MOD option with any ODS destination other than the Listing destination. Otherwise, you might receive unexpected output.
If the current output file is a file that is to be printed, available-lines must have a value of either 1 or PAGESIZE.
If you omit the N= option and no # pointer controls are used, one line is available; that is, by default, N=1. If N= is not used but there are # pointer controls, N= is assigned the highest value that is specified for a # pointer control in any PUT statement in the current DATA step.
Without suboptions, the default table definition uses the variable's label as its column heading. If no label exists, the definition uses the variable's name as the column heading.
If you specify FILE LOG, the number of lines that are output on the first page is reduced by the number of lines in the SAS start-up notes. For example, if PAGESIZE=20 and there are nine lines of SAS start-up notes, only 11 lines are available for output on the first page.
If you specify FILE PRINT in an interactive SAS session, then the Output window interprets the form-feed control characters as page breaks, and blank lines that are output before the form feed are removed from the output. Writing the results from the Output window to a flat file produces a file without page break characters. If a file needs to contain the form-feed characters, then the FILE statement should include a physical file location and the PRINT option.
To access the contents of the output buffer in another statement without using the _FILE_= option, use the automatic variable _FILE_.
file print; _file_ = '_FILE_'; put 'This is PUT';
file ABC; put 'Something' @; Y = _file_||' is here'; file ABC; put 'Nothing' ; Y = _file_||' is here';
file print linesleft=remain pagesize=20; put @5 name @30 phone @35 bldg @37 room;
data _null_;
file 'external-file' print n=pagesize;
do line=1 to 20; set info; put #line @col name $20. +1 phone 4.; end;
data _null_;
length myout $ 200;
file file-specification filename=myout;
put myout=;
stop;
run;
/* Start this first as the server */ filename serve socket ':5205' server recfm=s lrecl=25 blocksize=2500; data _null_; nb=25; infile serve nbyte=nb; input text $char25.; put _all_; run;