BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Paul_NYS
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
rickpaulos
Obsidian | Level 7

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.

View solution in original post

2 REPLIES 2
rickpaulos
Obsidian | Level 7

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.

Paul_NYS
Obsidian | Level 7

Thanks Rick. I wasn't thinking..

Paul

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 35658 views
  • 2 likes
  • 2 in conversation