BookmarkSubscribeRSS Feed
Elliott
Obsidian | Level 7

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;

1 REPLY 1
gergely_batho
SAS Employee

DO I=1 TO 2;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 912 views
  • 0 likes
  • 2 in conversation