How to convert probability to 0-100 scale

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

How to convert probability to 0-100 scale

Hello,everyone,

I need your kindly help again.

I have data as below:randid is just ID,each subject has a risk probability.I need to convert these probability to 0-100 scale,generate a new variable represent the risk score for each subject.

Thanks!

Jing

                    Obs    RANDID    prob

                           1     36459    0.09
                           2     67905    0.07
                           3     68194    0.14
                           4     70948    0.33
                           5     95182    0.22
                           6     98536    0.27
                           7    127196    0.18
                           8    147250    0.40
                           9    151110    0.27
                          10    162837    0.14
                          11    172770    0.09
                          12    204047    0.11
                          13    206291    0.09
                          14    207401    0.40
                          15    207538    0.22
                          16    256485    0.18
                          17    261349    0.27
                          18    276073    0.22
                          19    302824    0.09
                          20    303367    0.11
                          21    309257    0.18
                          22    309808    0.18
                          23    311966    0.40
                          24    336991    0.14
                          25    345164    0.07
                          26    346465    0.14
                          27    366964    0.40
                          28    388279    0.09
                          29    411906    0.40
                          30    418415    0.14


Accepted Solutions
Solution
‎11-29-2012 10:02 PM
Super Contributor
Posts: 1,636

Re: How to convert probability to 0-100 scale

Posted in reply to jing2000yr

Hi Jing,

Is this what you want?

data have;

input Obs    RANDID    prob;

cards;

                           1     36459    0.09

                           2     67905    0.07

                           3     68194    0.14

                           4     70948    0.33

                           5     95182    0.22

                           6     98536    0.27

                           7    127196    0.18

                           8    147250    0.40

                           9    151110    0.27

                          10    162837    0.14

                          11    172770    0.09

                          12    204047    0.11

                          13    206291    0.09

                          14    207401    0.40

                          15    207538    0.22

                          16    256485    0.18

                          17    261349    0.27

                          18    276073    0.22

                          19    302824    0.09

                          20    303367    0.11

                          21    309257    0.18

                          22    309808    0.18

                          23    311966    0.40

                          24    336991    0.14

                          25    345164    0.07

                          26    346465    0.14

                          27    366964    0.40

                          28    388279    0.09

                          29    411906    0.40

                          30    418415    0.14

   ;

   data want;

     set have;

  new=(prob-0.07)/(0.4-0.07)*100;

  proc print;run;

Obs    Obs    RANDID    prob        new

                        1      1     36459    0.09      6.061

                        2      2     67905    0.07      0.000

                        3      3     68194    0.14     21.212

                        4      4     70948    0.33     78.788

                        5      5     95182    0.22     45.455

                        6      6     98536    0.27     60.606

                        7      7    127196    0.18     33.333

                        8      8    147250    0.40    100.000

                        9      9    151110    0.27     60.606

                       10     10    162837    0.14     21.212

                       11     11    172770    0.09      6.061

                       12     12    204047    0.11     12.121

                       13     13    206291    0.09      6.061

                       14     14    207401    0.40    100.000

                       15     15    207538    0.22     45.455

                       16     16    256485    0.18     33.333

                       17     17    261349    0.27     60.606

                       18     18    276073    0.22     45.455

                       19     19    302824    0.09      6.061

                       20     20    303367    0.11     12.121

                       21     21    309257    0.18     33.333

                       22     22    309808    0.18     33.333

                                  The SAS System

View solution in original post


All Replies
Super User
Super User
Posts: 7,054

Re: How to convert probability to 0-100 scale

Posted in reply to jing2000yr

Are you just asking how convert a probability (a number between 0 and 1) into a percentage (a number between 0 and 100)?

How about just multiply by 100?

Or are you asking something more complicated? If so I think we more information.

Contributor
Posts: 23

Re: How to convert probability to 0-100 scale

Hi,Tom,

Thanks.

I am asking a more complicated one.Like here,the range is 0.07-0.40,based on the distribution,assign 0-100 scale to each of the corresponding probability.My real data set actually is very large,like more 2000 subjects.

Jing

Solution
‎11-29-2012 10:02 PM
Super Contributor
Posts: 1,636

Re: How to convert probability to 0-100 scale

Posted in reply to jing2000yr

Hi Jing,

Is this what you want?

data have;

input Obs    RANDID    prob;

cards;

                           1     36459    0.09

                           2     67905    0.07

                           3     68194    0.14

                           4     70948    0.33

                           5     95182    0.22

                           6     98536    0.27

                           7    127196    0.18

                           8    147250    0.40

                           9    151110    0.27

                          10    162837    0.14

                          11    172770    0.09

                          12    204047    0.11

                          13    206291    0.09

                          14    207401    0.40

                          15    207538    0.22

                          16    256485    0.18

                          17    261349    0.27

                          18    276073    0.22

                          19    302824    0.09

                          20    303367    0.11

                          21    309257    0.18

                          22    309808    0.18

                          23    311966    0.40

                          24    336991    0.14

                          25    345164    0.07

                          26    346465    0.14

                          27    366964    0.40

                          28    388279    0.09

                          29    411906    0.40

                          30    418415    0.14

   ;

   data want;

     set have;

  new=(prob-0.07)/(0.4-0.07)*100;

  proc print;run;

Obs    Obs    RANDID    prob        new

                        1      1     36459    0.09      6.061

                        2      2     67905    0.07      0.000

                        3      3     68194    0.14     21.212

                        4      4     70948    0.33     78.788

                        5      5     95182    0.22     45.455

                        6      6     98536    0.27     60.606

                        7      7    127196    0.18     33.333

                        8      8    147250    0.40    100.000

                        9      9    151110    0.27     60.606

                       10     10    162837    0.14     21.212

                       11     11    172770    0.09      6.061

                       12     12    204047    0.11     12.121

                       13     13    206291    0.09      6.061

                       14     14    207401    0.40    100.000

                       15     15    207538    0.22     45.455

                       16     16    256485    0.18     33.333

                       17     17    261349    0.27     60.606

                       18     18    276073    0.22     45.455

                       19     19    302824    0.09      6.061

                       20     20    303367    0.11     12.121

                       21     21    309257    0.18     33.333

                       22     22    309808    0.18     33.333

                                  The SAS System

Regular Contributor
Posts: 151

Re: How to convert probability to 0-100 scale

Posted in reply to jing2000yr

PROC STDIZE can do this for you, which saves hard coding the minimum / maximum values.

(uses data set created by )

proc stdize data=have out=want method=range mult=100;

var prob;

run;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 1842 views
  • 6 likes
  • 4 in conversation