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
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.