%let enddate=%sysfunc(today());
%let startdate=%eval(%sysfunc(today())-12);
%let enddate2=%sysfunc(today(),yymmddn8.);
%let startdate2=%eval(%sysfunc(today())-12);/* would like to convert 22512 into 20210820*/
%put &=startdate. &=enddate. &=enddate2 &=startdate2;
Use INTNX with %SYSFUNC:
%let startdate2=%sysfunc(intnx(day,&enddate,-12),yymmddn8.);
Use INTNX with %SYSFUNC:
%let startdate2=%sysfunc(intnx(day,&enddate,-12),yymmddn8.);
@alepage wrote:
%let enddate=%sysfunc(today());
%let startdate=%eval(%sysfunc(today())-12);
%let enddate2=%sysfunc(today(),yymmddn8.);
%let startdate2=%eval(%sysfunc(today())-12);/* would like to convert 22512 into 20210820*/
%put &=startdate. &=enddate. &=enddate2 &=startdate2;
If you are not using these variables in something a person reads, such as title in a report, you are much better off leaving these as the simple numeric values for use in calculations or comparisons.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.