BookmarkSubscribeRSS Feed
olivia123456
Fluorite | Level 6

How do you convert data scores that are normally out of 30 to out of 100 on SAS and how to round them to a 2 decimal space. 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

@olivia123456 wrote:

How do you convert data scores that are normally out of 30 to out of 100 on SAS


Do you mean you have scores 0 to 30 and you want them to be 0 to 100?

 

If so, you can multiply each score on the 0 to 30 scale by 100/30

 

and how to round them to a 2 decimal space.

 

Use the ROUND function

https://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=p0tj6cmga7p8qln1ejh6ebevm0c9.htm...

--
Paige Miller
olivia123456
Fluorite | Level 6

I am personally confused on the round function because I don't understand what to put in the parenthesis for round(x, #).

 

Yes two decimal space

 

I need to change the scale as in if I had a score of 19/30 and all my other numbers are out of 30, is there a SAS function for SAS to translate them all out of 100 such as 15/30 to 50/100?

ScottBass
Rhodochrosite | Level 12
/* algebra:
15/30 = X/100
(15/30)*100 = (X/100)*100
(15/30)*100 = X
*/

data want;
   do score=0 to 30;
      result30=score/30;
      result100=(result30)*100;
      result100rnd0=round(result100,1);
      result100rnd1=round(result100,.1);
      result100rnd2=round(result100,.01);  * <<< this is probably what you want? ;
      result100rnd3=round(result100,.001);
      output;
   end;
run;

 

is there a SAS function for SAS to translate them all out of 100 such as 15/30 to 50/100?

 

 No.  Nor is there one to translate them all from 23 to 105, 42 to 132, 13 to 48, etc.  But the math is relatively simple.


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1640 views
  • 2 likes
  • 3 in conversation