@Markanti wrote:
title " Using the where statement in procedures";
data hw.three;
input ID Height Weight Pulse Systolic Diastolic Group Gender Race Age;
datalines;
11 61 179 82 128 80 W2 F Black 39.6
12 66 160 80 150 96 W3 F Black 11.4
13 71 198 72 150 99 W1 M White 40.6
14 61 172 99 120 80 W2 F Black 39.6
15 71 237 90 126 90 W1 F Black 24.2
16 67 204 78 106 64 W3 M Black 40.7
17 69 135 100 130 90 W4 M Black 29.1
18 71 237 103 162 108 W3 M Black 16.9
19 60 208 70 130 90 W4 F Black 31.7
20 61 193 74 130 80 W1 F White 48.6
;
run;
That data step will throw many invalid data messages for Group, Gender and Race. Until you fix that you can't do anything useful involving any of those variables. And assumes you have assigned the HW library.
As this is obviously a homework assignment, please show us what you have tried. I think all of us will help you fix your code if you can't get it to work, but we will not do your homework for you from scratch. Please make a reasonable effort to create code that will work.
As an aside, your instructor (or professor) seems confused here; there is no need for both a new variable named agegroup AND a format. A format by itself will work without the new variable agegroup.
@Markanti wrote:
title " Using the where statement in procedures";
data hw.three;
input ID Height Weight Pulse Systolic Diastolic Group Gender Race Age;
datalines;
11 61 179 82 128 80 W2 F Black 39.6
12 66 160 80 150 96 W3 F Black 11.4
13 71 198 72 150 99 W1 M White 40.6
14 61 172 99 120 80 W2 F Black 39.6
15 71 237 90 126 90 W1 F Black 24.2
16 67 204 78 106 64 W3 M Black 40.7
17 69 135 100 130 90 W4 M Black 29.1
18 71 237 103 162 108 W3 M Black 16.9
19 60 208 70 130 90 W4 F Black 31.7
20 61 193 74 130 80 W1 F White 48.6
;
run;
That data step will throw many invalid data messages for Group, Gender and Race. Until you fix that you can't do anything useful involving any of those variables. And assumes you have assigned the HW library.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.