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

hello dear SAS experts,

 

I want to parametrize a macrovariable which I use in a bunch of programs. I wrote:

 

* Jahr eingeben ;

%let Jahr = 2022 ;

%put &Jahr. ;

 

* Macro-code fuer den Auswertungstag ;

%let Auswertungstag = '01JAN&Jahr.'D;

%put &Auswertungstag.;

 

I want to use &Jahr. to Change the year and get the Dates with the following form: '01JAN2022'D

What should I Change?

 

Regards

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

In order to resolve a macro variable it should be in  double quotes. Try

%let Auswertungstag = "01JAN&Jahr."D;

%put &Auswertungstag.;

View solution in original post

4 REPLIES 4
Shmuel
Garnet | Level 18

In order to resolve a macro variable it should be in  double quotes. Try

%let Auswertungstag = "01JAN&Jahr."D;

%put &Auswertungstag.;
Kurt_Bremser
Super User

Maxim 28, Macro Variables Need No Formats.

%let Auswertungstag = %sysfunc(inputn(&jahr.0101,yymmdd8.));

or

%let Auswertungstag = %sysfunc(mdy(1,1,&jahr.));

The raw numeric value works just like the "ddmmmyyyy"d string in code, but is much easier to handle, as you need never worry about quotes.

PierreYvesILY
Pyrite | Level 9
Thx to both of you.
PierreYvesILY
Pyrite | Level 9
Thank you Kurt.
I wish you a happy and successfull year 2021.
Thank you for your help in 2020,
Regards

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 576 views
  • 1 like
  • 3 in conversation