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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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