BookmarkSubscribeRSS Feed
Chrosen
Calcite | Level 5

I am using proc tabulate to generate a table containing mean and standard deviation for some variables. It returns a table where the values are given with two significant figures. Is there any way I can round off these values to the nearest whole number instead?

Code used:

proc tabulate data=sved.rank4 missing order=formatted;

where MMSEny ne .;

class diagnosid overall;

var diagnosage MMSEny ab42ny ttauny ptauny;

tables diagnosage MMSEny ab42ny ttauny ptauny,

diagnosid=''*(mean stddev)

overall=''*(mean stddev);

format diagnosid diagnosid_. overall overall_.;

run

;

/Christoffer

3 REPLIES 3
Ksharp
Super User

proc tabulate data=sved.rank4 missing order=formatted;

where MMSEny ne .;

class diagnosid overall;

var diagnosage MMSEny ab42ny ttauny ptauny;

tables diagnosage MMSEny ab42ny ttauny ptauny,

diagnosid=''*(mean*f=best8.0 stddev)

overall=''*(mean stddev);

format diagnosid diagnosid_. overall overall_.;

run

jakarman
Barite | Level 11

The best format will show as most possible digits.

Do you want to round off at your wishes use a proper format for that according your wish

---->-- ja karman --<-----
ballardw
Super User

You don't mention the range of values so I'm guessing as to how large to make the format. If you need more digits increase the 6 to the number needed, up to 32 any way.

diagnosid=''*(mean*f=f6.0 stddev*f=f6.0)

overall=''*(mean*f=f6.0 stddev*f=f6.0);

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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
  • 5166 views
  • 3 likes
  • 4 in conversation