Hi. I'm just starting out learning SAS Studio on SAS University Edition. I'm trying to copy a table, sashelp.class, into a new file called work.classname. When I run it, I get the errors below. A new file called classname is created in my work folder but I can't open it because it doesn't contain any columns (I get an error message on it). Any thoughts on how to correct this? And is there an easier way to make a copy of an existing file? Thanks.
data work.classname;
proc copy in=sashelp.class out=work.classname;
run;
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
42 ;
43 data work.classname;
NOTE: The data set WORK.CLASSNAME has 1 observations and 0 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
44 proc copy in=sashelp.class out=work.classname;
_____________
22
201
ERROR 22-322: Expecting a name.
ERROR 201-322: The option is not recognized and will be ignored.
45 run;
You only need part of the code above, either of the code below will create the classname file.
The first
data work.classname;
set sashelp.class;
run;
OR
proc copy in=sashelp.class out=work.classname;
run;
You only need part of the code above, either of the code below will create the classname file.
The first
data work.classname;
set sashelp.class;
run;
OR
proc copy in=sashelp.class out=work.classname;
run;
Reeza,
Thanks so much for helping me out.
The first solution using the data and set statements works.
The second solution using copy still gives me the error statements.
Regardless, I only need one that works.
Thanks again!
- Dave
Copy will copy from the libraries, the in/out should only have library names. I don't know if you can rename the file using proc copy though.
proc copy in=sashelp out=work;
select class;
run;quit;
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.