BookmarkSubscribeRSS Feed
Ken_oy
Fluorite | Level 6

Hi everyone,

I was creating a statistical report and wanted to have a p-value with 3 digits.

I got p=0.0501, but if I rounded it to 0.001 then I would have a p=0.05. How can I keep the last zero?

I used compress or compbl to make it into a string, but they did not work.

Any suggestions?

Thanks.

4 REPLIES 4
data_null__
Jade | Level 19
17         data _null_;
18            p=0.0501;
19            put p=pvalue5.3;
20            run;

p=
0.050
Ken_oy
Fluorite | Level 6

@data_null and @ballardw, thanks for the quick reply!

Just one more question. If I want to put "0.050" in a string, for example I may try to use "call symput" to make a &pvalue=0.050, then how can I do?

Thanks again!

data_null__
Jade | Level 19

PUT function

ballardw
Super User

For most purposes assigning a format with the appropriate number of decimal points will display as you want. I would suggest an f5.3. The internal storage of the value doesn't change just the display.

An example:

data _null_;  

file print;  

x = 0.05;  

put x f6.3;

run;

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!

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
  • 4 replies
  • 651 views
  • 0 likes
  • 3 in conversation