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';
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.