BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PharmlyDoc
Quartz | Level 8

How do I add a zero before the decimal when formatting a pvalue? 

 

data pvalue;
p = 0.00000;
run;

proc print data=pvalue;
format p pvalue6.3;
run;

 

format pvalue6.3 outputs "<.001" but I want the output to read as "<0.001"

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

One way is to create your own format:

 

proc format;
value mypval
low -< 0.001 = '<0.001'
other =[pvalue6.3]
;
run;

data example;
  x=0.000032;
  format x mypval6.3;
run;

you will need to make sure the format is available in each session you want to use it.

 

 

 

View solution in original post

2 REPLIES 2
ballardw
Super User

One way is to create your own format:

 

proc format;
value mypval
low -< 0.001 = '<0.001'
other =[pvalue6.3]
;
run;

data example;
  x=0.000032;
  format x mypval6.3;
run;

you will need to make sure the format is available in each session you want to use it.

 

 

 

PaigeMiller
Diamond | Level 26

A little experimentation seems to lead me to the conclusion that this is not possible with the PVALUE format.

 

I think you can create a PICTURE format for this. Example: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/proc/n1cfmr7vkts0wen1uy3mdge44phy.htm

--
Paige Miller
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1650 views
  • 4 likes
  • 3 in conversation