Date: Sun, 26 Oct 2003 15:04:07 GMT
Reply-To: LWn <villerwalle.nononospam@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: LWn <villerwalle.nononospam@YAHOO.COM>
Organization: Telia Internet
Subject: Re: SQL Problem
Something like this:
----------------------
data zero ;
input x y $ ;
CARDS;
2 I210
3 I210
2 I210
6 I210
7 I210
8 I210
3 I210
2 I210
2 I950
2 I950
3 I950
2 I950
6 I950
2 I950
;;;
proc sort data=zero ;
by y x ;
run ;
data zero ;
set zero ;
by y x ;
if first.x then freq = 1 ;
else freq + 1 ;
if last.x ;
run ;
proc print data=zero ;
run ;
----------------------
or you could use Proc Summary
HTH
/LWn
"Paul" <reganmian@yahoo.com> skrev i meddelandet
news:543f201d.0310260618.21afb3a2@posting.google.com...
> Hi
>
> Got cards
> CARDS;
> 2 I210
> 3 I210
> 2 I210
> 6 I210
> 7 I210
> 8 I210
> 3 I210
> 2 I210
> 2 I950
> 2 I950
> 3 I950
> 2 I950
> 6 I950
> 2 I950
>
> need to count distinct item no. and type, output to a dataset like
> 2 I210 3
> 3 I210 2
> ...
> 2 I950 4
> ...
>
> tried the sql:
> proc sql;
> create table ACCTNO as
> select DISTINCT A, B, COUNT(DISTINCT A)
> from OUT GROUP BY A;
> quit;
>
> but seems not working
>
> Can you help on this SQL, or other solutions?
>
> Many thanks
> Paul
|