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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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