@RW9 touched on this and I'm going to get specific:
DATA Tag_Test;
/* Method One */
/* Specified Date Rage as Character Strings */
Start_D = '01/04/2015';
End_D = '02/12/2015';
Start_Yr = INPUT(SUBSTR(Start_D,7,4),9.);
Start_Mo = INPUT(SUBSTR(Start_D,1,2),9.);
Start_Dy = INPUT(SUBSTR(Start_D,4,2),9.);
End_Yr = INPUT(SUBSTR(End_D,7,4),9.);
End_Mo = INPUT(SUBSTR(End_D,1,2),9.);
End_Dy = INPUT(SUBSTR(End_D,4,2),9.);
LY = Start_Yr - 1;
Is far from best practice. Create date values instead of playing with all the substrings.
DATA Tag_Test;
/* Method One */
/* Specified Date Rage as Character Strings */
Start_D = '01/04/2015';
End_D = '02/12/2015';
StartDate = input(start_d, anydtdte12.);
EndDate = input(end_d, anydtdte12.);
format StartDate EndDate mmddyy10.;
;
run;
And you may be suprised what you can accomplish just specifying an appropriate format when working with the values or the date functions in your queries.
... View more