BookmarkSubscribeRSS Feed
deleted_user
Not applicable
data _null_;
set ;
file infile
length ;

Thanks in advance.


regards,
Rupa
2 REPLIES 2
deleted_user
Not applicable
what is the functionality of the file infile ;
in this code.

Regards,
Rupa
Cynthia_sas
SAS Super FREQ
Hi:
This is not an ODS or Base Reporting Procedure (PRINT, REPORT, TABULATE) question. To understand what this program is doing, you would need to read in the documentation about these statements or other constructs:[pre]
DATA
SET
FILE
PUT
INFILE
INPUT
_INFILE_ (a buffer area created by SAS)
[/pre]

The SAS documentation has extensive and thorough documentation on using these statements in various combinations. Generally speaking, the FILENAME statement points to an external file to be read with SAS. Once you have POINTED to the file with a FILENAME statement, then you either read it into a SAS data set (using INFILE/INPUT statements) OR if the FILENAME statement points to an EXTERNAL file that you want to CREATE, then, you would use the FILE/PUT statements to write to the external file. If you use the external file name directly in the FILE or INFILE statement, then you do not need a FILENAME statement. A SET statement, on the other hand, points to a SAS data set that is being READ into a DATA step program. So these are equivalent programs:
[pre]
FILENAME makenew 'c:\temp\newfile.txt';
data _null_;
set sashelp.class;
length newvar $16;
file makenew;
newvar='wombat'||name;
put name age height newvar;
run;

data _null_;
set sashelp.class;
length newvar $16;
file 'c:\temp\newfile.txt';
newvar='wombat'||name;
put name age height newvar;
run;
[/pre]

Both programs read FROM the data set SASHELP.CLASS and write TO the TXT file c:\temp\newfile.txt. The NEWVAR variable is created with a LENGTH of 16 and is assigned a silly value (the string 'wombat' concatenated with each person's name). What is written to the external file is controlled by program logic and PUT statements in the program.

These papers and sites might be helpful to you to help explain your program:
http://www2.sas.com/proceedings/sugi31/246-31.pdf
http://www.albany.edu/~msz03/epi514/papers/datastep.pdf
http://www2.sas.com/proceedings/sugi28/189-28.pdf
http://www.sas.cc.vt.edu/datasets.html
http://www.albany.edu/csda/txtdel.pdf
http://analytics.ncsu.edu/sesug/2005/IN09_05.PDF

Otherwise, you might consider contacting SAS Technical Support for help with your specific program.

cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 708 views
  • 0 likes
  • 2 in conversation