Date: Thu, 21 May 2009 11:49:17 +0530
Reply-To: "N, Raghupathi" <raghupathi.n@GENPACT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "N, Raghupathi" <raghupathi.n@GENPACT.COM>
Subject: Re: Accumulative
In-Reply-To: A<200905210602.n4KLJDA8003924@malibu.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
Hi Yenny,
Can you try this out ...
data sample;
input sl_no Period $ ClassCode $ StudentID $;
cards;
1 Apr2008 C001 S1111
1 Apr2008 C002 S1111
1 Apr2008 C002 S2222
2 May2008 C003 S4444
2 May2008 C003 S2222
2 May2008 C003 S3333
2 May2008 C004 S2222
2 May2008 C004 S3333
3 Jun2008 C012 S1111
3 Jun2008 C012 S2222
3 Jun2008 C012 S3333
3 Jun2008 C012 S5555
;
run;
proc sql;
select count (distinct studentid) as std_id , 'APR2008' from sample
where sl_no in (1)
union
select count (distinct studentid) as std_id , 'MAY2008' from sample
where sl_no in (1,2)
union
select count (distinct studentid) as std_id , 'JUN2008' from sample
where sl_no in (1,2,3)
;
quit;
Thanks,,
Raghupathi
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Yenny Lyne
Sent: Thursday, May 21, 2009 11:32 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Accumulative
Hi,
I have a data like below:
Period ClassCode StudentID
Apr2008 C001 S1111
Apr2008 C002 S1111
Apr2008 C002 S2222
May2008 C003 S4444
May2008 C003 S2222
May2008 C003 S3333
May2008 C004 S2222
May2008 C004 S3333
Jun2008 C012 S1111
Jun2008 C012 S2222
Jun2008 C012 S3333
Jun2008 C012 S5555
I want count the unique headcount of student per Period like below:
Apr 2008 = 2
May 2008 = 4 (Accumulative figure from Apr 2008 to May 2008)
June2008 = 5 (Accumulative figure from Apr 2008 to Jun 2008)
Can anyone suggest how do this ?
Thanks in advance.
Regards,
Yenny
This e-mail (and any attachments), is confidential and may be privileged. It may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and disclosure or copying of its
contents or any action taken in reliance on it is unlawful. Unintended recipients must notify the sender immediately
by e-mail/phone & delete it from their system without making any copies or disclosing it to a third person.
|