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.
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;
Since I cant see your data, this code is untested.
data want;
set have;
where age between 0 and 5;
run;
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;
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!
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.