Pages

Friday, August 2, 2013

Widgets

SAS macro for breaking apart a date variable.

%macro breakdn(date);
****************************************************************;
* This macro breaks a date in the form of (MMDDYY) down into ;
* seperate month, day, and year variables. RSM 6/89 ;
****************************************************************;

month = floor(&date/10000);
day = mod(floor(&date/100),100);
year = mod(&date,100);
if day in (.,0,99) & month not in (.,0,99) then day=15;
yoh = year + (month-1)/12 + (day-1)/365.25; *Decimalized date;
%mend;

No comments:

Post a Comment