Date: Fri, 18 Aug 2006 07:48:26 -0700
Reply-To: jrdwthomas@HOTMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: jrdwthomas@HOTMAIL.COM
Organization: http://groups.google.com
Subject: Re: Individual Freq of multiple columns
In-Reply-To: <1155911797.987706.100870@m73g2000cwd.googlegroups.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi Eric,
Thanks for the response.
I'll try and explain a little better.
If i were to write...
proc summary data=info;
by column1;
output out=info2;
run;
This would give me a summary of column1 telling me how many times an
observations had occured in that column.
What i need is this doing to all 100 columns. This is why i came up
with 200. Basically something that looks like this
Column1¦_freq_¦column2¦ _freq_¦ column3¦ _freq_¦
abcd 3 gggg 4 dddd 6
ccvv 2 kkkk 6 eeee 8
bnm 0 aaaa 7 opuu 7
This is what i would ike the output to look like except there would be
many more columns!
Does this explain it a little better?
Thanks for the quick response.
Eric Hoogenboom wrote:
> I am not sure if I understand correctly. Especially the 200 confuses
> me. But let me guess.
>
> Apparently your columns together form a sort of multiple variable. This
> is a construct that SPSS knows, but SAS does not. You have to transform
> the dataset to a column/value form. It is easy in SAS. Probably you can
> adapt the example code below.
>
> data one;
> input c1-c5;
> datalines;
> 1 2 1 1 2
> 2 1 2 2 2
> 3 1 3 2 3
> run;
>
> data two (keep=val col);
> set one;
> array cols c1-c5;
> do i=1 to dim(cols);
> col = vname(cols(i));
> val = cols(i);
> output;
> end;
> run;
>
> proc freq data=two;
> tables val * col / nocum nocol norow nopercent missing;
> run;
>
>
> Hth,
> Eric
>
>
> jrdwthomas@hotmail.com wrote:
> > Hi,
> >
> > This is probably quite an easy task but i'm not personally able to find
> > a solution!
> >
> > Basically i have a sas dataset that has 100 columns and multiple rows
> > of data.For each column i would like to now the frequency of its
> > observations. This should give me a table that has columns with their
> > frequecies basically 200 columns.
> >
> > Does this make sense? Any help would be much appreciated.
> >
> > Thanks