Reputation: 431
I have a range of large (4- or 5-digit) numbers, which I need to raise to the -1 power. Because the numbers are all so large, they are obviously going to be very small when raised to that power. When I do it in SAS (using the elementwise operator), all the numbers in the output get rounded(?) to -1. So I get nothing but a lot of minus ones for the output.
Is this indeed the result of rounding? Can I get around this by formatting the output in a certain way? If so, what is the syntax for this? Again, sorry for asking about such simple things, I'm utterly new to SAS.
Code:
proc iml;
use sasdata.have;
read all var {Distance} into D;
print D;
Dmin = -1##D;
print Dmin;
quit;
Upvotes: 0
Views: 234
Reputation: 431
Never mind, I think I know what's been causing this. The problem was the order of operations! When I changed -1##D to D##-1, the strange transmogrification of all my numbers to -1 stopped, and I finally got the answers of the type I expected. I'm sorry, I'm very stressed and pressed for time at this moment, hence this dumb mistake in my code.
Upvotes: 0
Reputation: 63424
Your problem is that you're raising -1 to the power of 5000 (or whatever), as opposed to the opposite.
proc iml;
use work.have;
read all var {Distance} into D;
print D;
Dmin = D##-1;
print Dmin;
quit;
Upvotes: 1