BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Cruise
Ammonite | Level 13

Hi @Reeza and @Tom,

 

1. You're right. As a result of this experiment, I realized that I have old and young folks with a cancer hospitalized between 1995-2013 with age range of 7-107yrs. Code below shows how I tested and variable "test" has only 0,1 values depending whether they were hospitalized before or after their birthday.

2. Suggested formats didn't work but either substr and substrn identically worked out.

3. Critical thinking was required to question, perhaps folks I have here might just be old vs very young (7-107yrs).

 

Can I select two answers for SOLUTIONS? I truly appreciate your help indeed.

 


dy = substrn(left(dob), 1, 4);
dm = substrn(left(dob), 5, 2);
difference=hospitalized_year-dy;
cage=input(AGE,3.);
test=difference-cage;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 15 replies
  • 16878 views
  • 6 likes
  • 5 in conversation