BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Reeza
Super User
  Death_SAS_Date = input(put(DEATH_DT, 8. -l), YYMMDD10.) - Index;
  Death_days = Death_SAS_Date - Index;

You're subtracting the index twice. You can literally copy and paste my previous code to get this right.


@Sujithpeta wrote:

My bad @Kurt_Bremser, I corrected the code as @Reeza posted 

 

 

data M.Death;
set M.Death;
  Death_SAS_Date = input(put(DEATH_DT, 8. -l), YYMMDD10.) - Index;
  Death_days = Death_SAS_Date - Index;
run;

 

Death_SAS_Date still in the format of BEST12. and Death_days are also in the format of BEST12.

 

Death.PNG


 

Sujithpeta
Quartz | Level 8

I corrected but it still gives the same output @Reeza

Reeza
Super User
When I did it with the correct formulas it worked perfectly.

When you say something isn’t working, show your code. I suspect you still have two indexes in your code. The original code, without the N in the format and with only one index is still correct. If that doesn’t work post your full code and log.
PaigeMiller
Diamond | Level 26

@Sujithpeta wrote:

@Reeza I tried the code but it's throwing error.

 

Death.PNG

 

I also tried changing the YYMMDDN10. to YYMMDDN8. I had the same error.


Please copy and paste the SASLOG as text (not as an image) into the {i} window.

--
Paige Miller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 18 replies
  • 2565 views
  • 1 like
  • 4 in conversation