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 (December 2006, 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 Dec 2006 19:52:08 -0500
Reply-To:   Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:   Re: Comparison across columns??
Comments:   To: Margaret Asmani <margaretasmani@HOTMAIL.CO.UK>

Margaret,

I'm sure that someone will eventually offer a more elegant solution but, if you have to get this done before you can celebrate the holidays, something like the following should at least come close to your desired solution:

data have; input A B C D E; id=_n_; cards; 25 32 65 32 89 65 32 47 89 96 41 52 63 96 45 12 45 65 98 78 45 56 89 78 63 45 89 56 89 56 56 89 56 45 78 45 56 56 78 89 12 45 98 65 78 12 12 32 35 56 ; run;

proc transpose data=have out=need; id id; run;

proc rank data=need out=almost_want; var _1-_10; ranks test1-test10; run;

proc transpose data=almost_want out=almost_want2; run;

data almost_want3; set almost_want2; name=compress(_name_,'_ test'); run;

proc sort data=almost_want3; by name; run;

data want; set almost_want3; array ranks(5); array ranks(5); retain values ranks; if mod(_n_,2) eq 1 then do; values(1)=A; values(2)=B; values(3)=C; values(4)=D; values(5)=E; end; else do; ranks(1)=A; ranks(2)=B; ranks(3)=C; ranks(4)=D; ranks(5)=E; output; end; run;

%macro doanalysis; %do i=1 %to 5; title "Variable" &i.; proc freq data=want (where=(ranks&i. eq 1)); tables values&i.; run; %end; %mend; %doanalysis

HTH, Art ---------- On Sat, 30 Dec 2006 18:26:05 -0500, Margaret Asmani <margaretasmani@HOTMAIL.CO.UK> wrote:

>Thanks very much everybody for the very useful suggestions. > >I use Florio's code as it's convenient not having to list the variables >again considering that I have a large number. A follow-up question: is it >possible to compute frequencies only for 1, i.e. the lowest values only? > >Happy New Year!! > >Margaret


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