%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
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.