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.
this helped.
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 🙂
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 🙂
@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';
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.