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. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1424 views
  • 1 like
  • 3 in conversation