The SAS Output Delivery System and reporting techniques

can any one explain this code

Reply
N/A
Posts: 0

can any one explain this code

data _null_;
set ;
file infile
length ;

Thanks in advance.


regards,
Rupa
N/A
Posts: 0

Re: can any one explain this code

Posted in reply to deleted_user
what is the functionality of the file infile ;
in this code.

Regards,
Rupa
SAS Super FREQ
Posts: 8,866

Re: can any one explain this code

Posted in reply to deleted_user
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
Ask a Question
Discussion stats
  • 2 replies
  • 145 views
  • 0 likes
  • 2 in conversation