05-30-2014 06:06 AM
I want to apply different precision to the same variable depending on other variable value without using round function.
|Value||Decimal place||Final value|
05-30-2014 07:03 AM
05-30-2014 08:07 AM
Sorry, I just assumed he didn't want to use that function, not that he didn't want rounding. I would assume the only reason not to use rounding would be significant figures? If some then its a fair bit more complicated, though there are quite a few formulae on the net to do that - or of course just use string functions.
05-30-2014 08:18 AM
This might work. Assuming character value.
05-30-2014 09:14 AM
I would like to use PUTN as RW9 suggested, and proc format wouldn't round it .
data have; infile cards dlm=' ' truncover; input value d; format value 10.0 ; cards; 1 1 2.3 3 0 4 3.5678 2 0.0002 5 4.4034 1.703 0 ;;;; run; proc format; picture dec0_ low-high='9'; picture dec1_ low-high='9.9'; picture dec2_ low-high='9.99'; picture dec3_ low-high='9.999'; picture dec4_ low-high='9.9999'; picture dec5_ low-high='9.99999'; run; data have; set have; format=ifc(missing(d),'best32.',cats('dec',d,'_')); new=putn(value,format); run;
05-30-2014 09:56 AM
Thanks all for your suggestions. Variable (column) labeled as VALUE is numeric.
I didn't wanted to use round function because
if A=B then color=RED
if A <B then color=GREEN
I am exporting these values to a dashboard where variable A value should appear as one decimal precision.
now if I use ROUND(A,0.1) THEN A value would be 0.7, In the dashboard value of A AND B would appear as 0.7 and COLOR value as GREEN.