05-22-2014 09:50 PM
I have a variable with data
X= - 0.0076
X= - 0.5
Can anyone help me get all these numbers with same decimal place while keeping the + and - sign in the begining of each number.
Thank you- sign in the begining
05-23-2014 10:32 AM
How many decimal points do you want displayed? Do want trailing 0 to pad to that length?
Assuming you want 4 decimals then a custom format such as this should work. Make sure the data is read as numeric not character.
proc format library=work;
low -<0 = '0009.9999'(prefix='-')
0 - high= '0009.9999'(prefix='+');
input x ;
proc print data=have;
format x MyDec.;
05-24-2014 05:15 AM
You've taken exactly the approach I was playing with as well when I run into some "picture" behaviour I didn't understand. https://communities.sas.com/thread/58118
Suggest you add "round" to your format like data _null_ suggested in the link posted.
...and: I believe '0' should just be '0' and not +0