Help using Base SAS procedures

FORMATS

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,040
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: 9,676

Re: FORMATS

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: 9,676

Re: FORMATS

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: 10,497

Re: FORMATS

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

Super User
Posts: 17,818

Re: FORMATS

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

☑ This topic is SOLVED.

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

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