Array for date conversion issue

Reply
Contributor
Posts: 69

Array for date conversion issue

Hi,

I was helped with this several weeks ago.  I have tested the array with 1 variable and it worked fine today I tried 2 variables and only the last variable in the array list converted the first variable was blank.  I don't know what is wrong.  How do I make the array work with more than 1 variable.

Thanks,

data test;

infile datalines;

input lstbilldt 8. lstpaydt 8. ;

datalines;

1150603 1080716

1150603 901015

1150603 1100115

1150602 1100315

1150602 1021118

1150601 1100628

1150602 1130515

1150601 1011203

1150604 1080319

;

run;

data testarray;

set test;

ARRAY MF_DATE(2) LSTBILLDT LSTPAYDT;         

ARRAY SAS_DATE(2) LAST_BILL_DATE LAST_PAY_DATE;

FORMAT LAST_BILL_DATE LAST_PAY_DATE MMDDYY10.;

DO I=2 TO 2;                                          

  **** TO CARE FOR INVALID AND NULL DATES *****;      

MONTHDAY=MOD(MF_DATE(I),10000);                       

CENTURY=FLOOR(MF_DATE(I)/1000000);                    

MONTH=FLOOR(MONTHDAY/100);                            

DAY=MOD(MONTHDAY,100);                                

YEAR=MOD(FLOOR(MF_DATE(I)/10000),100)+(CENTURY+19)*100;

IF MF_DATE(I) IN (.,0,9999999) THEN SAS_DATE(I)=.;    

ELSE SAS_DATE(I)=MDY(MONTH,DAY,YEAR);                 

END;                                                  

run;

SAS Employee
Posts: 340

Re: Array for date conversion issue

DO I=1 TO 2;

Ask a Question
Discussion stats
  • 1 reply
  • 176 views
  • 0 likes
  • 2 in conversation