Hi Team,
i need one help
How to export multiple files in sas by using file name statement
Advance Thanks
Hello!
In which format do you want to export data from SAS? In .xlsx, in .sas7bdat, in .csv, others?
in text format
Have a look, thats not what you need?
proc sql; create table t1 as select * from sashelp.air; quit;
%let path ="/home/sasserver/sasuser/files/test.txt"; /*input your path*/
proc export data=t1
outfile=&path.
label dmbs=tab replace;
putnames=yes;
%run;
If you need other formats it is also possible.
by using data step file name statment
So you want to export multiple datasets to external files?
Do the datasets have identical structure?
proc sort data=sashelp.class out=have;
by sex;
run;
data _null_;
set have;
fvar=cats('c:\temp\',sex,'.txt');
file dummy filevar=fvar dsd mod;
put (_all_) (:);
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.