BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

I have the following dataset:

 

Subject       Score                

1                  3.432

2                  4.83455

3                  6.8333

4                  14.834

 

and i want: 

 

Subject       Score                Score_round

1                  3.432                    3

2                  4.83455                5

3                  6.8333                  7

4                  14.234                  14

 

So far I've only found (but only as an output):

 

data new;
format score 9.0;
set old;
run;

 I ultimately want a new variable created in the dataset called score_round (from the score variable)

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20
data have;
input Subject       Score  ;              
cards;
1                  3.432
2                  4.83455
3                  6.8333
4                  14.834
5                  14.234 
;
data want;
set have;
score_round=round(score);
run;

did you try the round function?

 

score_round=round(score);

 

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20
data have;
input Subject       Score  ;              
cards;
1                  3.432
2                  4.83455
3                  6.8333
4                  14.834
5                  14.234 
;
data want;
set have;
score_round=round(score);
run;

did you try the round function?

 

score_round=round(score);

 

starz4ever2007
Quartz | Level 8

thank you!! thought it was gonna be something more complicated 🙂

PaigeMiller
Diamond | Level 26

Although you can create a new variable that is the rounded value, perhaps you really want a format to show the rounded value rather than a new variable? There's good reasons to do things your way, and there's good reasons to NOT do things your way. It depends.

--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1011 views
  • 1 like
  • 3 in conversation