Date: Fri, 22 May 2009 11:10:39 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: Summarizing data- need assistance
Dinesh,
I'm sure there is better way than the following, but I think it will do
what you want:
proc transpose data=have out=want;
id slno;
run;
data want (keep=total clusters);
set want (rename=(_name_=name));
all=cat(of _:);
all=tranwrd(all,'.',' ');
total=countc(all,'1234');
clusters=length(trim(left(compbl(all))))
-length(compress(left(all)))+1;
run;
Art
--------
On Fri, 22 May 2009 06:41:22 -0700, Dinesh <mtdinesh@GMAIL.COM> wrote:
>hello friends
>
>I am a fresher in SAS
>
>I am facing a problem
>
>I have a data set like this...
>
>slno 1d1 1d2 1d3 1d4
>1 . . . .
>2 . . 3 .
>3 1 . 3 .
>4 1 . 3 .
>5 1 2 3 .
>6 1 2 3 .
>7 . 2 3 .
>8 . 2 3 .
>9 . 2 3 4
>10 . . . 4
>11 1 . . 4
>12 1 . . 4
>13 1 . . 4
>14 1 . . 4
>15 1 2 . 4
>16 . 2 . 4
>17 . 2 . 4
>18 . 2 . 4
>19 . 2 3 4
>20 . 2 3 .
>21 1 . 3 .
>22 1 . 3 .
>23 1 . 3 .
>24 1 . 3 .
>
>I want to summarize this data set in such a way that i have to count
>the number of clusters in each column, and also the total number of
>elements in each column. The number of elements in each cluster will
>be different
>
>The output I need is
>
> 1d1 1d2 1d3 1d4
>total 13 11 14 11
>clusters 3 2 2 1
>
>Please provide some ideas to solve this.
>
>thanks in advance
>
>Dinesh
|