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;

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2131 views
  • 0 likes
  • 3 in conversation