%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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.