i want to call the fill name from the local directory. my file name will be month.xlsx. month name will be to the current month filename.
How can i include in the proc import the dynamic filename.
@radha009 wrote:
i want to call the fill name from the local directory. my file name will be month.xlsx. month name will be to the current month filename.
How can i include in the proc import the dynamic filename.
So if you ran it now would you expect to find February.xlsx or March.xlsx
The easiest way seems to use a macro variable.
%let month = %sysfunc(today(), monname20.);
%put &month.;
If sas is not running locally, you can't access local files.
my sas is running locally. i have full path in the Proc import data file. i have to change every month my script to the change the file name to generate a reprot.i am looking something that look for the filename from the folder.
Are you using display manager or enterprise guide? With EG you could add a prompt allowing you to select the file to import. The name can be computed if rules exist. If you just want the latest file in a folder, using cmd/powershell to get the filename is recommended, because, compared to a full-implementation in sas, less code is required. If you want / have to do it in sas have a look at the functions dopen, dnum, dread, fopen, finfo ...
@radha009 wrote:
i want to call the fill name from the local directory. my file name will be month.xlsx. month name will be to the current month filename.
How can i include in the proc import the dynamic filename.
So if you ran it now would you expect to find February.xlsx or March.xlsx
The easiest way seems to use a macro variable.
%let month = %sysfunc(today(), monname20.);
%put &month.;
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.