Date: Mon, 24 Oct 2005 21:59:20 -0400
Reply-To: Tony Yang <tonyyangsxz@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tony Yang <tonyyangsxz@GMAIL.COM>
Subject: Re: Counting entries across variables
In-Reply-To: <BAY106-F75968A5148BFD1A38045793760@phx.gbl>
Content-Type: text/plain; charset=ISO-8859-1
You can try this code
array a{20} d1-d20;
count=0;
do i=1 to 20;
if a{i}=. then do;
count=count+1;
end;
end;
then you can use proc freq to tabulate variable count, the value in count
indicates how many variables in d1-d20 have missing entry.
Hope this helps.
Best regards,
Tony
On 10/24/05, Laughing Beggar <laughing_beggar@hotmail.com> wrote:
>
> Hi all,
> I have 20 character variables (d1-d20), that fill up from the left (ie
> there
> wont be an entry in d2 if there isnt one in d1 etc). I need to count how
> many records have an entry (of any non-missing sort) in d1 only, then how
> many records have an entry in d1 and d2 only, then in d1-d3 only, then in
> d1-d4 only etc. So for each record I need to know how many of the d1-d20
> are
> filled (call it x)and then I need a frequency distibution of x ("200
> records
> have one (and only one) of d1-d20 filled, 150 have 2 (and only 2) filled,
> 56
> have 3 (and only 3) filled etc). All tips on how I might do this will be
> greatly appreciated.
> Cheers
> L_B
>
> "The beggar laughs in the face of the thief"
>
|