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

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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