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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 873 views
  • 1 like
  • 3 in conversation