June 29, 2005, 05:25 PM
LloydProblem with Recompute
Hi all, if I have a statement as follows
<br />COMPUTE NJUNO/P9CN=IF JUNO LE 0 THEN 0 ELSE JUNO;AS '&M3,Open'
and my values for JUNO are
-1000
500
200
so when I run my report I get
0
500
200
but now on my recompute line I also get 0, I guess that is becuase The sum of the actual values is less than 0, but how do I make it only look at the
COMPUTED VALUES so that I would get 700?
June 29, 2005, 07:56 PM
MickeyLloyd,
If I understand correct this is what you are trying to do. I have used the DEALER_COST - 10000 to create negative values. Compute can be used like define as in the following code.
COMPUTE FILE CAR
DCOST/I8 = DEALER_COST - 10000;
TEMP/P9CN = IF DCOST LE 0 THEN 0 ELSE DCOST;
END
TABLE FILE CAR
PRINT
CAR
DCOST
TEMP
ON TABLE RECOMPUTE AS 'Total'
END
Hope this helps
M
June 30, 2005, 12:10 AM
GCohenSince you are only displaying positive values why do you need the RECOMPUTE at all? A simple Column-total will give you 700 in your example.
June 30, 2005, 01:58 AM
susannahLloyd,
can you possibly use a define
NJUNO/P9=MAX(0,JUNO);
or
can you possibly do
COMPUTE NJUNO/P9=MAX(0,JUNO);NOPRINT
COMPUTE NJUNO1/P9=NJUNO; AS 'nicelabel'
June 30, 2005, 02:05 PM
LloydActually I was doing it the way Mickey shows( which his example does work), but for some reason I kept getting zero as the total. My assumption was, that because the sum of the actual values is less than zero, that it displayed the zero. I'll have to do some more testing with the actual data to see why I was getting the zero