Help using Base SAS procedures

FORMATS

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,041
Accepted Solution

FORMATS


I HAVE A AGE VARIABLE WITH VALUES seen as 82.54 55.36 ETC

THE VARIABLE HAS an undelying COMMA 8.2 FORMAT

HOW CAN I ROUND THE VALUE OF THIS AGE

Regards


Accepted Solutions
Solution
‎05-01-2013 01:52 AM
Super User
Posts: 10,028

Re: FORMATS

Posted in reply to robertrao

use round() or int() or roof() or floor() .

data _null_;

age=82.54 ;

x=round(age);

xx=int(age);

put x= xx=;

run;

Ksharp

View solution in original post


All Replies
Solution
‎05-01-2013 01:52 AM
Super User
Posts: 10,028

Re: FORMATS

Posted in reply to robertrao

use round() or int() or roof() or floor() .

data _null_;

age=82.54 ;

x=round(age);

xx=int(age);

put x= xx=;

run;

Ksharp

Super User
Posts: 11,343

Re: FORMATS

Posted in reply to robertrao

Or generate your output for the variable using an F3.0 format.

Super User
Posts: 19,805

Re: FORMATS

Posted in reply to robertrao

You generally floor() or int() age rather than round. Someone who is 18.7 is still 18, not 19.

🔒 This topic is solved and locked.

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

Discussion stats
  • 3 replies
  • 281 views
  • 3 likes
  • 4 in conversation