Call for help

Discussions about CSEntry
Post Reply
MarcOlivier
Posts: 13
Joined: November 20th, 2016, 5:54 am

Call for help

Post 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 ?
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Call for help

Post 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;
  
Saint
Posts: 63
Joined: November 22nd, 2013, 4:59 am

Re: Call for help

Post 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.
MarcOlivier
Posts: 13
Joined: November 20th, 2016, 5:54 am

Re: Call for help

Post 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
MarcOlivier
Posts: 13
Joined: November 20th, 2016, 5:54 am

Re: Call for help

Post 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;
MarcOlivier
Posts: 13
Joined: November 20th, 2016, 5:54 am

Re: Call for help

Post 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;
MarcOlivier
Posts: 13
Joined: November 20th, 2016, 5:54 am

Re: Call for help

Post 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
Saint
Posts: 63
Joined: November 22nd, 2013, 4:59 am

Re: Call for help

Post by Saint »

Most welcome MarcOlivier. Happy to be of help so we grow the CSPro community!
Post Reply