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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 481 views
  • 1 like
  • 3 in conversation