Hi Team,
I have a Data folder in SAS DI which has over 152 Tables. I need to export these 152 datasets to be copied as .csv files and need to be exported to a local folder .
Could you let me know
Assuming these table have different table structures.
The answer depends on what level of lineage you require.
From implementation/coding perspective, you can easily write a macro that exports all table in a libref to a certain location.
Fore some traceability. you can add this into a DI Studio job an link all source table to this step.
For full lineage, you would use the file writer transformation on each source table and have a corresponding external file object defined.
Suppose we have the following dataset in SAS:
/*create dataset*/
data my_data;
input A B C;
datalines;
1 4 76
2 3 49
2 3 85
4 5 88
2 2 90
4 6 78
5 9 80
;
run;
/*view dataset*/
proc print data=my_data;
We can use the following code to export this dataset to a CSV file called data.csv:
/*export dataset*/
proc export data=my_data
outfile="/home/u13181/data.csv"
dbms=csv
replace;
run;
I can then navigate to the location on my computer where I exported the file and view it:
The data in the CSV file matches the dataset from SAS.
Regards,
Rachel Gomez
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.