I have a program file that exports individual Excel sheets as .csv files which represent a month of the year (12 total).
In turn each of these .csv files are turned into a SAS dataset (again 12 total). I then consolidate these monthly files into a single SAS dataset.
Question: Is there a line (or lines) of code I can add to my program file to automatically export my consolidated SAS dataset into a folder on my computer? I tried PROC EXPORT but it wouldn't work since the DBMS option apparently doesn't apply to SAS datasets?
I am new to SAS. Any advice appreciated.
Thanks.
It isn't usually referred to export, but saving a dataset. You need to assign a library to save the data set.
You can use PROC COPY, or a DATA/PROC SQL step to move the data to the library.
libname out 'c:\user\homareau\PredictiveModels\Attrition\';
proc datasets library=work nodetails nolist;
copy in=work out=out;
select naics_bankrupt_2013;
run;quit;
If you're running SAS on a server with EG on teh server this may not work, since EG will not be able to see your desktop.
In that case look for a TASK called Copy Files from Chris Hemindinger.
What format do you want the dataset exported to?
Some of the options for DBMS to specific databases such as Access, DB2, Teradata, Oracle and such require specific SAS/ACCESS modules loaded.
If you want a generic CSV or similar file it should work.
Please post the attempted Proc Export code for more targetted responses.
I want to export the SAS dataset as a SAS dataset...
This is what I tried:
proc export data=naics_bankrupt_2013 outfile='c:\user\homareau\PredictiveModels\Attrition\naics_bankrupt_2013.sas7bdat'
dbms=?? (no option for a SAS dataset here?)
label replace;
run;
It isn't usually referred to export, but saving a dataset. You need to assign a library to save the data set.
You can use PROC COPY, or a DATA/PROC SQL step to move the data to the library.
libname out 'c:\user\homareau\PredictiveModels\Attrition\';
proc datasets library=work nodetails nolist;
copy in=work out=out;
select naics_bankrupt_2013;
run;quit;
If you're running SAS on a server with EG on teh server this may not work, since EG will not be able to see your desktop.
In that case look for a TASK called Copy Files from Chris Hemindinger.
Excellent Reeza! Works like a charm. Thanks again...Jack
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.