I desperately need help with this program! I can't seem to get the last section (In bold) to work. I know that the 'value' step won't work, but I don't know what to use that will let me change BMI value. I originally had this as a proc format step, but that ended up with my label changes interrupting my variable changes. PLEASE HELP!
Data female_pr;
Input Gender $1-6 Height $8-9 Weight $11-13 Rate_before $14-17 Rate_after $19-21 ;
Datalines;
female 68 140 96 124
female 56 125 90 127
female 69 118 70 85
female 160 88 115
female 65 140 76 93
female 62 110 68 122
female 63 127 65
female 64 160 87 115
female 70 170 53 39
female 66 200 60 78
female 63 120 127
female 60 138 84 107
female 66 236 64 71
female 65 230 104 102
female 68 130 82 116
Run;
Run;
Proc print data=female_pr;
Run;
Data male_pr;
Input Gender $1-6 Height $7-9 Weight $11-13 Rate_before $14-17 Rate_after $19-21 ;
Datalines;
male 72 185 61 96
male 76 160 85 97
male 75 200 38 68
male 73 145 79 98
male 73 200 54 82
male 73 235 78 90
male 74 155 60 80
male 61 183 55 64
male 69 160 67 100
male 72 140 54 71
male 73 170 65 106
male 72 265 63 96
Run;
Run;
Proc print data= male_pr;
Run;
Data pulserate;
Input Gender $1-6 Height $8-9 Weight $11-13 Rate_before $14-17 Rate_after $19-21 ;
Datalines;
female 65 140 76 93
female 62 110 68 122
female 63 127 65 83
female 64 160 87 115
female 70 170 53 39
female 66 200 60 78
male 73 235 78 90
male 74 155 60 80
male 61 183 55 64
male 69 160 67 100
male 72 140 54 71
male 73 170 65 106
male 72 265 63 96
Run;
Run;
Proc print data=pulserate;
Run;
Data comb_rate;
Set female_pr male_pr pulserate;
if gender='male' then
do;
BMI=703*weight/(height*height);
end;
if gender='female' then
do;
BMI=695*weight/(height*height);
end;
Rate_change=rate_after-rate_before;
run;
proc print data=comb_rate;
run;
data format;
label rate_change='Pulse Rate Change'
BMI='Body Mass Index';
value bmifmt
Low-25='Normal'
26-35 ='Low Risk'
36-High='High Risk';
run;
proc print data=comb_rate;
FORMAT BMI bmifmt.;
run;
Thank you SO much! You're a lifesaver!
I think you were almost there. Try this...
Data comb_rate;
Set female_pr male_pr pulserate;
label rate_change='Pulse Rate Change'
BMI='Body Mass Index';
if gender='male' then
do;
BMI=703*weight/(height*height);
end;
if gender='female' then
do;
BMI=695*weight/(height*height);
end;
Rate_change=rate_after-rate_before;
run;
proc print data=comb_rate;
run;
proc format;
value bmifmt
Low-25='Normal'
26-35 ='Low Risk'
36-High='High Risk';
run;
proc print data=comb_rate label;
FORMAT BMI bmifmt.;
run;
Yes! Thank you! On the other feed you replied to, I was thinking you meant to add the label after proc print!
Thank you for your help!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.