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

Hello Experts,

 

I would like to get the year 2020 in macro varaible "annee" but my code doesn't work:

%let annee=%sysevalf(year(%sysevalf(today()));

 

Thank you for your help!

 

Best regards

1 ACCEPTED SOLUTION
6 REPLIES 6
SASdevAnneMarie
Barite | Level 11
Thank you Kurt,

What do you mean when you say "non-integer"?
Ksharp
Super User
%let annee=%sysfunc(today(),year4.);
%put annee=&annee ;
Venky3110
Fluorite | Level 6

Try this code:-

/*method1*/
data _null_;
call symputx('annee',put(intnx('year',today(),0),year4.));
run;

%put &annee;

/*method2*/
%let annee=%sysfunc(today(),year4.);
%put &annee;

Venky3110
Fluorite | Level 6

/*method1*/
data _null_;
call symputx('annee',put(intnx('year',today(),0),year4.));
run;

%put &annee;

/*method2*/
%let annee=%sysfunc(today(),year4.);
%put &annee;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 6 replies
  • 1354 views
  • 2 likes
  • 4 in conversation