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"
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.
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.
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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.