BookmarkSubscribeRSS Feed
SteelersPitts
Obsidian | Level 7

Hi,

 

I'm trying to import a csv file and then export a sas dataset as on output but I'm running into issues. Can anyone let me know where I'm going wrong? My code logic is as follows:

 

Import:

Proc Import out=xyz

datafile='c:\User\Folder\File_Abc.csv'

DBMS =csv replace;

run;

 

SAS Dataset export

Libname out 'c:\user\Desktop';

data out.test;

set xyz;

run;

 

I'm receiving an error saying "set is not allowed in the data statement". 

 

Can anyone let me know how I export the sas dataset here? Thank you. 

 

 

6 REPLIES 6
Urban_Science
Quartz | Level 8

You need to close your quotation marks for both times you use it. Also, you had an extra semicolon in the proc import statement.

 

Proc Import out=xyz
   datafile='c:\User\Folder\File_Abc.csv'
   DBMS =csv replace;
run;

 


Libname out 'c:\user\Desktop';

data out.test;
set xyz;
run;
SteelersPitts
Obsidian | Level 7

I apologize for the missing quotes and extra semi-colon in the post. However, the code has proper quotes and semi-colon but it still does throw up errors.

Urban_Science
Quartz | Level 8
Without seeing the errors, my guess is that the paths are wrong. C:\Users\<User Name>\
But that could be an editing mistake when posting.
Urban_Science
Quartz | Level 8
I didn't see that you edited your post. Nevermind with the path. My new guess is that you might have forgotten a semicolon after data out.test
Reeza
Super User

Post the full log from the code you're running.

 


@SteelersPitts wrote:

Hi,

 

I'm trying to import a csv file and then export a sas dataset as on output but I'm running into issues. Can anyone let me know where I'm going wrong? My code logic is as follows:

 

Import:

Proc Import out=xyz

datafile='c:\User\Folder\File_Abc.csv'

DBMS =csv replace;

run;

 

SAS Dataset export

Libname out 'c:\user\Desktop';

data out.test;

set xyz;

run;

 

I'm receiving an error saying "set is not allowed in the data statement". 

 

Can anyone let me know how I export the sas dataset here? Thank you. 

 

 


 

SteelersPitts
Obsidian | Level 7

My bad! Code is working fine now. There was a missing semi-colon. Thanks everyone. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 6 replies
  • 520 views
  • 1 like
  • 3 in conversation