Can someone help me with my formatting?

Reply
Occasional Contributor
Posts: 5

Can someone help me with my formatting?

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;

Respected Advisor
Posts: 3,777

Re: Can someone help me with my formatting?

proc print data=comb_rate label;
   
FORMAT BMI bmifmt.;
   
label rate_change='Pulse Rate Change'
          BMI=
'Body Mass Index';
   
run;
Occasional Contributor
Posts: 5

Re: Can someone help me with my formatting?

Thank you SO much! You're a lifesaver!

Contributor
Posts: 29

Re: Can someone help me with my formatting?

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;

Occasional Contributor
Posts: 5

Re: Can someone help me with my formatting?

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!

Ask a Question
Discussion stats
  • 4 replies
  • 210 views
  • 2 likes
  • 3 in conversation