Page 1 of 1

Call for help

Posted: November 20th, 2016, 6:06 am
by MarcOlivier
Morning everyone§
I would like to know how to succeed to make sum with differents items even when the values of some of those item are "notApply" or just blank ?

Re: Call for help

Posted: November 20th, 2016, 1:17 pm
by josh
You can use a loop to calculate the sum and exclude the values that are notappl.
numeric total = 0;
do numeric i = i while i <= totocc(THINGTOSUM)
  
if THINGTOSUM(i) <> notappl then
    total = total + THINGTOSUM(i);
  
endif;
enddo;
  

Re: Call for help

Posted: November 21st, 2016, 11:44 am
by Saint
By different items do you mean different variables? In that case you can turn on:

Code: Select all

set behavior() specialvalues(zero) on; 
In that case you can include all the variables in a normal sum equation, and the not applicable will evaluate to zero.

Re: Call for help

Posted: November 22nd, 2016, 5:49 am
by MarcOlivier
Thanks Saint for your answer. You got what on I have wrotten to call for help. but I don't know to use your syntax. where should I have to put it ?
thanks to everyone who answer to me

Re: Call for help

Posted: November 22nd, 2016, 6:07 am
by MarcOlivier
That is my syntax, which I want to use. seem like it doesn't work due to the fact that in some of variables in the left side can notapply or blank

PROC B_A_POURQUOI_LA_VENTE_ESU
preproc
if QUANTITE_DE_CH + QUANTITE_DE_CI + QUANTITE_DE_CJ + QUANTITE_DE_CK > QUANTITE_DE_LA_PT then
skip to A_COMBIEN_AVEZ_VOUS_OBT
endif;

Re: Call for help

Posted: November 22nd, 2016, 6:20 am
by MarcOlivier
That is my syntax, which I want to use. seem like it doesn't work due to the fact that in some of variables in the left side can be notapply or blank

PROC B_A_POURQUOI_LA_VENTE_ESU
preproc
if QUANTITE_DE_CH + QUANTITE_DE_CI + QUANTITE_DE_CJ + QUANTITE_DE_CK > QUANTITE_DE_LA_PT then
skip to A_COMBIEN_AVEZ_VOUS_OBT
endif;

Re: Call for help

Posted: November 22nd, 2016, 4:49 pm
by MarcOlivier
Thank you Saint
Thank you very much
Now I found my way
It works very well your CODE
I found how to use it
thanks everyone

Re: Call for help

Posted: November 23rd, 2016, 3:47 am
by Saint
Most welcome MarcOlivier. Happy to be of help so we grow the CSPro community!