How do I convert a SAS date such as "30JUL2009"d into YYYYMMDD format (eg 20090730) ??
so for instance:
data _null_;
format test ?????;
test=today();
put test=;
run;
would give me "test=20090730" in the log....
How do I convert a SAS date such as "30JUL2009"d into YYYYMMDD format (eg 20090730) ??
so for instance:
data _null_;
format test ?????;
test=today();
put test=;
run;
would give me "test=20090730" in the log....
here's how I did it in macro, but surely there must be a format??!!!
%let today=%sysfunc(compress(%sysfunc(today(),yymmddd10.),'-'));
its weird - the INFORMAT yymmdd8. gives YYYYMMDD result, whereas the FORMAT yymmdd8. gives a YY-MM-DD result!!
%let expectdate1=%sysfunc(putn(%eval(%sysfunc(today())-1),yymmddn8.));
You want to use the format yymmddn8. The 'n' means no separator.
Per http://support.sas.com/kb/24/610.html you can specify B for blank, C for colon, D for dash, N for no separator, P for period, or S for slash.