As above, I have tables, each is uploaded monthly after the year and date 20203, eg Is it possible to select a file automatically, e.g. if it is September, it will select a file from September in select or you have to do it manually in the code each time.
@Gieorgie wrote:
As above, I have tables, each is uploaded monthly after the year and date 20203, eg Is it possible to select a file automatically, e.g. if it is September, it will select a file from September in select or you have to do it manually in the code each time.
Do you really mean: "if it is September 2021, it will select the file from September 2021"??
If so, then this will work to create a macro variable &thismonth with the value 202110, since today is October 1, 2021
%let thismonth=%sysfunc(putn(%sysfunc(today()),yymmn6.));
so you would want to use the data set named
BH_D_ZAB_X_ALOK_&thismonth
Yes, I think this is possible, but I have some questions:
(1) Do the files have the same naming convention (e.g., "BH_D_ZAB_X_ALOK")?
(2) Are the files in this directory the same kind of file? Or are there other files in the directory that don't contain the same information?
(3) Do you only want the most recent file for the given month/year? Or do you want all files that have the current month?
@Gieorgie wrote:
As above, I have tables, each is uploaded monthly after the year and date 20203, eg Is it possible to select a file automatically, e.g. if it is September, it will select a file from September in select or you have to do it manually in the code each time.
Do you really mean: "if it is September 2021, it will select the file from September 2021"??
If so, then this will work to create a macro variable &thismonth with the value 202110, since today is October 1, 2021
%let thismonth=%sysfunc(putn(%sysfunc(today()),yymmn6.));
so you would want to use the data set named
BH_D_ZAB_X_ALOK_&thismonth
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.