I have a data set we'll say is simply called "MyDataset". Normally this would be saved as a file called "MyDataset.sas7bdat". However, some automated program on the server (not SAS) moves older files into an archive appends dates to the file - so now my file is called: "MyDataset.01Dec2022.sas7bdat"
How can I read this file in SAS without renaming the file? Third party ODBC connectors don't seem to have an issue, but I'm just trying to use windows sas.exe and I get all kinds of errors.
LibName myLib 'E:\Archive' ;
proc contents data =myLib.MyDataset.01Dec2022;
run;
-or-
proc contents varnum data='E:\Archive\MyDataset.01Dec2022.sas7bdat';
run;
If I rename the file so the filename matches the dataset name, I have no issues. How can I read the file without changing the file name?
Normally dots are not accepted as part of a data set name because of other syntax, such as the LIBNAME.DATASET rules.
If you want to use those non-standard names then you set the option Validmemname=Extend to allow non-standard dataset names and then use a name literal, the name enclosed in quotes followed by an N.
options validmemname=extend; proc contents data=mylib.'Mydataset.01Dec2022'n ; run;
Two things come to my mind.
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.