Using a DATA step, first, convert these character strings to SAS DATE variables using the INPUT function in an assignment statement, then after identifying your maximum value, setup a DO / END loop to iteratate from 1 to 24, as shown below:
%LET RANGE = 24;
DATA _NULL_;
RETAIN MYDATE "&SYSDATE9"D;
FORMAT MYDATE DATE9.;
ARRAY APDVALS (*) PDVAL1-PDVAL⦥
FORMAT PDVAL: YYMMN6.;
* now load up the array based on the date var MYDATE. ;
DO X = 1 TO ⦥
APDVALS(X) = INTNX('MONTH',MYDATE,-X);
END;
* now show the results to the SASLOG - formatted for effect. ;
PUTLOG _ALL_;
RUN;
Scott Barry
SBBWorks, Inc.