| Date: | Thu, 13 Aug 2009 10:09:24 -0700 |
| Reply-To: | Amy <amyzyj92@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Amy <amyzyj92@GMAIL.COM> |
| Organization: | http://groups.google.com |
| Subject: | Re: conditional cumulative sum |
|
| Content-Type: | text/plain; charset=ISO-8859-1 |
sorry, I think I did not make it clear enough.
the only data in the file is the variable called a, data under b
variable is the result I want to get use some programming.
thanks.
On Aug 13, 12:03 pm, nathaniel.wood...@DOM.COM (Nathaniel Wooding)
wrote:
> Amy
>
> Take a look at the following
>
> data test;
> input a b;
> cards;
> 1 1
> 0 0
> 0 0
> 1 1
> 1 2
> 0 0
> 0 0
> 0 0
> 1 1
> 1 2
> 1 3
>
> ;
> run;
> Data test;
> set test;
> if a ne 0 then newb + 1;* this does a cumulative sum;
> else newb = 0;
> run;
> proc print;
> run;
>
> Nat Wooding
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SA...@LISTSERV.UGA.EDU] On Behalf Of Amy
> Sent: Thursday, August 13, 2009 11:56 AM
> To: SA...@LISTSERV.UGA.EDU
> Subject: conditional cumulative sum
>
> hey,
>
> my data is look like this:
>
> a b
> 1 1
> 0 0
> 0 0
> 1 1
> 1 2
> 0 0
> 0 0
> 0 0
> 1 1
> 1 2
> 1 3
> a is the original number, and b is the cumulative sum when a is not 0.
>
> can anyone help me to figure this out?
>
> thank you!
> CONFIDENTIALITY NOTICE: This electronic message contains
> information which may be legally confidential and or privileged and
> does not in any case represent a firm ENERGY COMMODITY bid or offer
> relating thereto which binds the sender without an additional
> express written confirmation to that effect. The information is
> intended solely for the individual or entity named above and access
> by anyone else is unauthorized. If you are not the intended
> recipient, any disclosure, copying, distribution, or use of the
> contents of this information is prohibited and may be unlawful. If
> you have received this electronic transmission in error, please
> reply immediately to the sender that you have received the message
> in error, and delete it. Thank you.- Hide quoted text -
>
> - Show quoted text -
|