BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Gieorgie
Quartz | Level 8

Gieorgie_0-1633092903149.png

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.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

@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

 

 

--
Paige Miller

View solution in original post

3 REPLIES 3
maguiremq
SAS Super FREQ

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?

PaigeMiller
Diamond | Level 26

@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

 

 

--
Paige Miller
Gieorgie
Quartz | Level 8
You are best ! have a nice weekend

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 617 views
  • 0 likes
  • 3 in conversation