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;
DO I=1 TO 2;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.