BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jerrylshen
Obsidian | Level 7
libname pre "C:folder name";

%let ds1="File Name Has Space(s)";  
/*File is .xlsx */

data old;
	set pre.&ds1.; 
        /*Error here with the file name */
run;

I did a quick google search, I saw several that mentions Pipe, which I assume it doesn't really apply to me.  

Thanks

 

EDIT: turns out its a .CSV file.  

http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n02nz0e7cykqhun14hcpp...  

 

this helped.

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

If your file is .xlsx then the data step is not the way to go. Use PROC IMPORT instead. Do a Google search, thousands of examples out there 🙂

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

If your file is .xlsx then the data step is not the way to go. Use PROC IMPORT instead. Do a Google search, thousands of examples out there 🙂

Reeza
Super User
Spaces in file names are not issues in SAS.

Your code is wrong (syntax is incorrect), which is the issue. Make sure it first works without macro variables and then add macro variables.
Tom
Super User Tom
Super User

@jerrylshen wrote:
libname pre "C:folder name";

%let ds1="File Name Has Space(s)";  
/*File is .xlsx */

data old;
	set pre.&ds1.; 
        /*Error here with the file name */
run;

I did a quick google search, I saw several that mentions Pipe, which I assume it doesn't really apply to me.  

Thanks


Is the file a SAS dataset, like your last step is assuming.  Or is it an XLSX file, like your comment says?

 

To use a dataset name that includes a space (why would you want to?) you need to set the VALIDMEMNAME option to extend and use a name literal.

options validmemname=extend ;
proc print data=pre."name with space"n ;
run;

To read from an XLSX file you can use PROC IMPORT or the XLSX libname engine.

libname pre xlsx 'name of the xlsx file';

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 9572 views
  • 2 likes
  • 4 in conversation