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;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.