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!
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.