Date: Mon, 20 Jun 2011 15:22:30 -0500
Reply-To: Robin R High <rhigh@UNMC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robin R High <rhigh@UNMC.EDU>
Subject: Re: A Count question
In-Reply-To: <201106201908.p5KAmBJm006027@willow.cc.uga.edu>
Content-Type: text/plain; charset="US-ASCII"
PROC FREQ and ODS gives another alternative:
PROC SORT DATA=indat; by subject; run;
ods output nlevels=nlv(drop=tablevar rename=(nlevels=parts));
ods listing close;
proc freq data=indat nlevels;
by subject;
table parts;
run;
ods listing;
proc print data=nlv; run;
Obs subject parts
1 1001 2
2 2003 3
Robin High
UNMC
From:
Tom Smith <need_sas_help@YAHOO.COM>
To:
SAS-L@LISTSERV.UGA.EDU
Date:
06/20/2011 02:11 PM
Subject:
A Count question
Sent by:
"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
I have a following dataset with two variables: subject (Charecter) parts
(numeric):
subject parts
------- -----
1001 1
1001 1
1001 2
2003 3
2003 4
2003 10
I need to count how many different values for the variable "part" by
subject is available.
the output should be as below:
subject parts
------- -----
1002 2
2003 3
Thanks a lot.