LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 1997, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 17 Jan 1997 13:36:00 -0500
Reply-To:   Dave_Mabey_at_RDA8POSTOFFICE1%RDCCMAIL%READERSDIGEST@RMAIL.COM
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Dave_Mabey_at_RDA8POSTOFFICE1%RDCCMAIL%READERSDIGEST@RMAIL.COM
Subject:   Re[2]: comm1-comm6 problem
Comments:   To: j_weedon@ESCAPE.COM
Content-type:   text/plain; charset=US-ASCII

New Text Item: Re: comm1-comm6 problem

Lisa,

I would use the following.

PROC SQL; select case when comm1 ne . then comm1 when comm2 ne . then comm2 when comm3 ne . then comm3 when comm4 ne . then comm4 when comm5 ne . then comm5 when comm6 ne . then comm6 when comm7 ne . then comm7 else -1 end as index, count(*) from comfile group by index;

** Generic Signature **

______________________________ Reply Separator ____________________________ _____ Subject: Re: comm1-comm6 problem Author: j_weedon@ESCAPE.COM@INTERNET at RDNOTES Date: 1/16/97 11:11 AM

(Embedded image moved to file: PIC001.PCX) On Thu, 16 Jan 1997 08:51:23 -0500, Lisa Bastian <eagle89@EROLS.COM> wrote:

>I have a total of about 67 codes (numeric), any of which can be found >among six consecutive fields (comm1 comm6), although for each >observation, a code can only show up once. Is there any "easy" way to >count the occurrence of each individual code? ie., without an array and >a bunch of "if" statements? Thanx.

Please put a subject line in your posts. Does this do what you want:

%macro comms; data new (keep=comm); set old (keep=comm1-comm6); %do i=1 %to 6; comm=comm&i; output; %end; proc freq data=new; run; %mend; %comms

I'm not sure what your aversion to arrays is, but a non-macro solution with an array would be:

data new (keep=comm); set old (keep=comm1-comm6); array comms comm1-comm6; do over comms; comm=comms; output; end; proc freq data=new; run;

Jay Weedon. SMTPOriginator: owner-sas-l@VM.MARIST.EDU


Back to: Top of message | Previous page | Main SAS-L page