Hi everyone,
I am new to SAS.
I mainly use SAS EG for my work because I am a novice to SAS. I am wondering where SAS stores the output after you ran code?
Apart from that, normally when running SAS, I want to export the output and afterwards, I will import such output to other SAS code to make sure that my code is not too long.
Traditionally, I use the export button and it leads me to save the file under sas7bdat or csv, or mdb, or txt format.
So, I am not sure how to write the code to export this file under sas7bdat format and the code to import again rather than just export and import manually by using buttons
Or, I really appreciate if you can share any other solution from your experience by importing and exporting SAS output.
Cheers.
Export
libname myfolder 'path to folder';
proc copy in=work out=myfolder;
select export_dataset;
run;
quit;
Check export dataset
proc print data=myfolder.export_dataset;
run;
Import the export_dataset
Libname input 'path to folder';
data want;
set input.export_dataset;
run;
Export
libname myfolder 'path to folder';
proc copy in=work out=myfolder;
select export_dataset;
run;
quit;
Check export dataset
proc print data=myfolder.export_dataset;
run;
Import the export_dataset
Libname input 'path to folder';
data want;
set input.export_dataset;
run;
SAS datasets are already stored in files with a .sas7bdat extension, so there is no need to export. Just copy the files to the location where you want them.
Exporting is necessary when you want to create "external files", like csv or spreadsheets.
Text files (like csv) are written with a data step, Excel files can be created with PROC EXPORT or LIBNAME XLSX.
Since your SAS session most probably runs on a remote server, you need to download the exported files, this is done with the Copy Files task in EG.
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.