Hi,
I'm trying to set data in a table by reading a file. However, SAS is not able to recognize the file. Any suggestion is highly appreciated.
File: ABCD_062018 (This is monthly file with a date stamp, therefore I want to use a wild card to read the file and make it date independent)
File Location: C:\Desktop\Folder
Now in SAS I'm creating a lib as follows:
Libname Path C:\Desktop\Folder
Data Table;
Set Path."ABCD_%";
Run;
Error:
ABCD_% is not a valid name (I've tried replacing % by *, moving the quotes, changing to single quotes but nothing works.
Any thoughts on how to resolve this issue?
Is this a sas data set or text file?
If it's a text file, you first need to import it into SAS and create a data set.
If it's a SAS data set you need to set the libname (correctly) and the wildcard is : for data set names, not % or with quotes.
libname myFiles 'C:\desktop\folder\';
data ABCD;
set myFiles.ABCD_: ;*will read all files with ABCD prefix;
run;
@SteelersPitts wrote:
Hi,
I'm trying to set data in a table by reading a file. However, SAS is not able to recognize the file. Any suggestion is highly appreciated.
File: ABCD_062018 (This is monthly file with a date stamp, therefore I want to use a wild card to read the file and make it date independent)
File Location: C:\Desktop\Folder
Now in SAS I'm creating a lib as follows:
Libname Path C:\Desktop\Folder
Data Table;
Set Path."ABCD_%";
Run;
Error:
ABCD_% is not a valid name (I've tried replacing % by *, moving the quotes, changing to single quotes but nothing works.
Any thoughts on how to resolve this issue?
Is this a sas data set or text file?
If it's a text file, you first need to import it into SAS and create a data set.
If it's a SAS data set you need to set the libname (correctly) and the wildcard is : for data set names, not % or with quotes.
libname myFiles 'C:\desktop\folder\';
data ABCD;
set myFiles.ABCD_: ;*will read all files with ABCD prefix;
run;
@SteelersPitts wrote:
Hi,
I'm trying to set data in a table by reading a file. However, SAS is not able to recognize the file. Any suggestion is highly appreciated.
File: ABCD_062018 (This is monthly file with a date stamp, therefore I want to use a wild card to read the file and make it date independent)
File Location: C:\Desktop\Folder
Now in SAS I'm creating a lib as follows:
Libname Path C:\Desktop\Folder
Data Table;
Set Path."ABCD_%";
Run;
Error:
ABCD_% is not a valid name (I've tried replacing % by *, moving the quotes, changing to single quotes but nothing works.
Any thoughts on how to resolve this issue?
You're awesome! Thanks!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.