Hello,
I agree the SUBJECT is unrelated to the post content, so I will focus on the post content, not the SUBJECT.
The code below demonstrates how to use the PUT function with assigning a SAS variable, representing your input and output file names. SAS code below uses the DO LOOP technique but without requiring macro language, only using SAS DATA step language to generate the SAS code.
You have some choices with SAS -- depending on your SAS expertise using DATA step and MACRO language to generate (and execute) SAS code using SAS code. Here is one technique that does not require any MACRO language.
Obviously you will need to fill-in your data-input and data-output coding portions.
Suggest you take this template example, add your own code for the INPUT and OUTPUT processing, and come back to the discussion forum if there are any more questions -- very important to share what code you have in order to get the most valuable and meaningful feedback.
Scott Barry
SBBWorks, Inc.
* One technique using DATA step logic to generate SAS code. ;
* No MACRO coding involved -- for some, a good thing to consider. ;
filename tempsas temp; /* temp file to store instream generated SAS code */
data _null_;
file tempsas;
do i=1 to 500;
* build input file name string - demo shows suffix # 1 to 500, as in: ;
* c:\data\InputFile_500.txt for illustration purposes only. ;
length input_file output_file $255;
input_file = "c:\data\DetailInputFile_" !! put(i,3. -l) !! ".txt";
output_file = "c:\data\MEANSOutputFile_" !! put(i,3. -l) !! ".txt";
put "filename MyInputData " input_file "; " /
"DATA _your_sas_file_;" /
"INFILE MyInputData;" /
"* more DATA step code goes here; " /
"RUN;" /
"* Maybe PROC MEANS step code goes here; " /
"RUN;" /
"filename MyOutputData " output_file "; " /
"DATA _NULL_;" /
"FILE MyOutputData;" /
"* DATA step code for PUT to flat file goes here; " /
"RUN;" ;
end;
stop;
run;
* now include the SAS code generated in the DATA step above. ;
%include tempsas;