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

Please i have a dataset in which i want to keep only people who are aged from 0-5. The data set have list of people up to 17 years but i just want to create a dataset of only kids that are aged 0-5 and for the data-set to retain all the variables. The age variable is is sc_age.

I initially tried using the "where" statement in the larger data step to specify the category but it was not helpful as i will want to run a logistic regression later.

 

Please how do i go about this and any help will be appreciated.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

Have you tried to subset the 0-5 age, using where statement, into a separate data-set

to be used for the regression?

data age0_5;
  set have (where=(sc_age le 5); /* or between 0 and 5 - to exclude missing */
run;

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Since I cant see your data, this code is untested.

 

data want;
   set have;
   where age between 0 and 5;
run;
Shmuel
Garnet | Level 18

Have you tried to subset the 0-5 age, using where statement, into a separate data-set

to be used for the regression?

data age0_5;
  set have (where=(sc_age le 5); /* or between 0 and 5 - to exclude missing */
run;

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
  • 2 replies
  • 645 views
  • 0 likes
  • 3 in conversation