Date: Mon, 31 Oct 2011 18:26:33 -0700
Reply-To: oslo <oslo@yahoo.com>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: oslo <hokut1@YAHOO.COM>
Subject: Re: commen frequency
In-Reply-To: <CAM+YpE9asT4mzZiGpom9r8tQNnhQ-bhBT1vfPN3Y-7-PsfODeQ@mail.gmail.com>
Content-Type: text/plain; charset=iso-8859-1
Dear Joe;
Thanks a lot. It is much appreciated,
Oslo
________________________________
From: Joe Matise <snoopy369@GMAIL.COM>
To: SAS-L@LISTSERV.UGA.EDU
Sent: Monday, October 31, 2011 6:37 PM
Subject: Re: commen frequency
SQL would do this nicely:
proc sql;
select sum(case when varA=varB then 1 else 0 end) as varAvarB,
sum(case when varB=varC then 1 else 0 end) as varBvarC,
sum(case when varC=varD then 1 else 0 end) as varCvarD,
sum(case when varA=varB and varB=varC then 1 else 0 end) as varAvarBvarC
...
from have [group by things if you need to];
quit;
If you want to do this programmatically you can from dictionary.columns.
-Joe
On Sun, Oct 30, 2011 at 11:00 PM, oslo <hokut1@yahoo.com> wrote:
> Dear SAS-L Users;
>
> I have a data set with 4 columns given as follows. I need get the commen frequency of variable in the columns. That is I need get
> a) Frequency of the same variables in A-B columns
> b) Frequency of the same variables in A-C columns
> c) Frequency of the same variables in A-D columns
> d) Frequency of the same variables in B-C columns
> .
> .
> Then frequency of the same variables in A-B-C columns
> Frequency of the same variables in A-B-D
> .
> .
> At the end the frequency of the same variables in A-B-C-D
>
> Best regards,
> Oslo
>
>
>
> A B C D
> rs29024430 rs43708440 rs29024430 r29024430
> rs29009912 rs29009907 rs43708440 rs43708440
> rs29009979 rs29009912 rs29009907 rs29010802
> rs29010147 rs29012086 rs29009912 rs17871338
> rs29010295 rs29012174 rs29009979 rs29009907
> rs29010510 rs29013844 rs29010295 rs29009912
> rs29011155 rs29016146 rs29010461 rs29009979
> rs29012070 rs29017980 rs29011155 rs29010295
> rs29012174 rs29018185 rs29012070 rs29010461
|