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: 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 16. 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
  • 15 replies
  • 16293 views
  • 6 likes
  • 5 in conversation