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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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