Hello
I am not sure how to ask this question.
Is there a way to format the output in case of very very small numbers without rounding them
For example 0.0000006 can I have SAS to write the output as 6 e^-6 or anything similar?
I know that there is round(x,0.0001) but I want to keep the number as it is just the output to be in short hand.
Thank you
proc iml;
power = -10:-3;
x= 10**power;
print x[format=E10.];
Your question is about how to do this in PROC IML?
Where do you want to see this formatted output? Please be very detailed.
Formats.
Exponential formats are probably what you want...but where are you planning to use this in IML?
Not 100% sure this can be used in whatever step you're looking for it.
@Salah wrote:
Hello
I am not sure how to ask this question.
Is there a way to format the output in case of very very small numbers without rounding them
For example 0.0000006 can I have SAS to write the output as 6 e^-6 or anything similar?
I know that there is round(x,0.0001) but I want to keep the number as it is just the output to be in short hand.
Thank you
The format is amazingly enough the Ew. format, for exponential. For example e10. preserves 10 significant digits
data example; x= 0.0000002345; put x= e10.; run;
with a result of
x=2.345E-07
The format can be used to display 32 characters but the documentation displays up to 14 significant digits.
Thank you for the help. But I am not sure this works in SAS/IML!
proc iml;
power = -10:-3;
x= 10**power;
print x[format=E10.];
When the base is a scalar, the ** and ## operators are equivalent. I used 10**power since most DATA step programmers are more familiar with the ** operator for raising a scalar to a power.
But, sure, you can use ## if you prefer.
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 16. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.