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 (April 2005, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 30 Apr 2005 09:01:04 -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: Count
Comments:   To: Thomas T <tythong@YAHOO.COM>

Thomas,

Mark's suggested SQL solution already does what you want. One, non-sql approach might be:

data foo; input id $ x1 x2 x3 x4 x5 x6; datalines; a 1234 2345 0349 1234 5678 1234 b 7890 0123 7890 7890 . 0123 c 1234 4567 8901 3456 2456 0012 d 0987 8765 3456 . . . ; run; proc transpose data=foo out=bar; by id; run; proc sort data=bar nodupkey; by id col1; run; proc means data=bar n nonobs; class id; var col1; output out=temp n=; run; data final (drop=_: rename=(col1=count_diff)); merge foo temp; by id; if _type_ eq 1; run;

Art -------- On Sat, 30 Apr 2005 01:14:10 -0400, Thomas <tythong@YAHOO.COM> wrote:

>May I know how to count the non-missing variables with different numbers >but treat the same numbers as one count? > >*data; >id x1 x2 x3 x4 x5 x6 >a 1234 2345 0349 1234 5678 1234 >b 7890 0123 7890 7890 . 0123 >c 1234 4567 8901 3456 2456 0012 >d 0987 8765 3456 . . . > >*expected; >id x1 x2 x3 x4 x5 x6 count_diff >a 1234 2345 0349 1234 5678 1234 4 >b 7890 0123 7890 7890 . 0123 2 >c 1234 4567 8901 3456 2456 0012 6 >d 0987 8765 3456 . . . 3


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