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 ?
Call for help
Re: Call for help
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;
do numeric i = i while i <= totocc(THINGTOSUM)
if THINGTOSUM(i) <> notappl then
total = total + THINGTOSUM(i);
endif;
enddo;
Re: Call for help
By different items do you mean different variables? In that case you can turn on:
In that case you can include all the variables in a normal sum equation, and the not applicable will evaluate to zero.
Code: Select all
set behavior() specialvalues(zero) on;
-
- Posts: 13
- Joined: November 20th, 2016, 5:54 am
Re: Call for help
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
thanks to everyone who answer to me
-
- Posts: 13
- Joined: November 20th, 2016, 5:54 am
Re: Call for help
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;
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;
-
- Posts: 13
- Joined: November 20th, 2016, 5:54 am
Re: Call for help
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;
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;
-
- Posts: 13
- Joined: November 20th, 2016, 5:54 am
Re: Call for help
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
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
Most welcome MarcOlivier. Happy to be of help so we grow the CSPro community!