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!
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.