Hi
I would like to export a SAS data set keeping it in SAS format (sas7bdat). I have tried variations of PROC EXPORT below and none seem to work. Has anyone used the CPORT proc for this?
Paul
proc export data=work.surrenderTprCount
outfile='F:\MetricFiles\9_2013'
DBMS=sas
replace;
run;
Do you want to make a copy in a different folder or on a different drive with the same data set name?
DATA "samedrive:\NEWfoldername\samedatasetname";
SET "samedrive:\OLDfoldername\samedatasetname";
RUN;
DATA "Newdrive:\foldername\samedatasetname";
SET "Oldrive:\foldername\samedatasetname";
RUN;
You could use two LIBNAME statements instead (can be useful for lengthy programs with many data set references or if you move your files around often) :
LIBNAME oldlocation "C:\myfolder\sas\work";
LIBNAME newlocation "F:\MetricFiles";
DATA newlocation.samedatasetname;
SET oldlocation.samedatasetname;
RUN;
Or just use windows explorer (MY Computer or Computer) to just move or copy the file directly (click and drag). You won't mess up a sasb7dat file by moving it. SASb7dat files don't normally contain their own location within themselves.
If you are just trying to rename the data set name.
DATA libraryname.NEWname;
SET libraryname.OLDname;
RUN;
BTW. "work." is the default location, you don't have to specify that. ie: data=work.surrenderTprCount is the same as data=surrenderTprCount
PS, PROC IMPORT, EXPORT, CPORT, CINPORT are intended to change the format. They have plenty of traps waiting for you.
Do you want to make a copy in a different folder or on a different drive with the same data set name?
DATA "samedrive:\NEWfoldername\samedatasetname";
SET "samedrive:\OLDfoldername\samedatasetname";
RUN;
DATA "Newdrive:\foldername\samedatasetname";
SET "Oldrive:\foldername\samedatasetname";
RUN;
You could use two LIBNAME statements instead (can be useful for lengthy programs with many data set references or if you move your files around often) :
LIBNAME oldlocation "C:\myfolder\sas\work";
LIBNAME newlocation "F:\MetricFiles";
DATA newlocation.samedatasetname;
SET oldlocation.samedatasetname;
RUN;
Or just use windows explorer (MY Computer or Computer) to just move or copy the file directly (click and drag). You won't mess up a sasb7dat file by moving it. SASb7dat files don't normally contain their own location within themselves.
If you are just trying to rename the data set name.
DATA libraryname.NEWname;
SET libraryname.OLDname;
RUN;
BTW. "work." is the default location, you don't have to specify that. ie: data=work.surrenderTprCount is the same as data=surrenderTprCount
PS, PROC IMPORT, EXPORT, CPORT, CINPORT are intended to change the format. They have plenty of traps waiting for you.
Thanks Rick. I wasn't thinking..
Paul
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.