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 (October 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 24 Oct 2005 23:01:17 -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: Counting entries across variables

L_B,

I think you are asking for something like:

data start; informat a1-a20 $1.; array a(*) a1-a20 _char_; array b(20); infile cards truncover; input a1-a20; do i=0 to dim(a)-1; if a(i+1) eq '' then leave; else b(i+1)=1; end; cards; a b a b c a b c d ; run; proc freq data=start; tables b1-b20; run;

Art -------- On Tue, 25 Oct 2005 01:47:59 +0000, 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"


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