%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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.