%let date=&sysdate9.;
%put &date;
%let month_year=%sysfunc(inputc("&date",date9.),monyy7.);
%put month_year;
Here i am trying output monyy7. (APR2023) using sysdate9.
required output
APR2023
@BrahmanandaRao wrote:
hi miller
it shows only text as below i think macro processor cannot read macro variable
month_year
Its really unclear what you mean by this. My code works properly. When something doesn't work, you need to show us the code you are using that isn't working. Saying something doesn't work is never sufficient. We don't know what you did, you have to SHOW us.
%let month_year=%sysfunc(inputn(&date,date9.),monyy7.);
hi miller
it shows only text as below i think macro processor cannot read macro variable
month_year
@BrahmanandaRao wrote:
hi miller
it shows only text as below i think macro processor cannot read macro variable
month_year
Its really unclear what you mean by this. My code works properly. When something doesn't work, you need to show us the code you are using that isn't working. Saying something doesn't work is never sufficient. We don't know what you did, you have to SHOW us.
You are working way too hard.
You have a 9 character string and you want the last 7 characters of it.
644 %let month_year=%substr(&sysdate9,3); 645 %put &=sysdate9 &=month_year ; SYSDATE9=13APR2023 MONTH_YEAR=APR2023
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!
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.