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 (June 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 20 Jun 2008 11:48:28 -0400
Reply-To:   Prasad Samala <sitaram.samala@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Prasad Samala <sitaram.samala@GMAIL.COM>
Subject:   Re: Comparing across respondents

Thank you very much. I am very new to the listserv and the response to my first post is overhelming. I bet I am gonna spend good amount of time here.

Coming to the problem in hand, now I have 6 ways of arriving at the solution. I have my own 3 ways and 1 each from Mary, Datanull & Barry. Thank you, guys.

I am using proc sql on one version(almost similar to what Datanull was suggesting), proc freq on the second one and IML on the third one. I find all the solutions you provided, to be very efficient way of doing things (like the one where Mary suggested to check for duplicates). But the common problem on all these codes except one is the time it takes to arrive at the solution, as I am dealing with 5000 respondents here. I came up with a code in IML, which looks naive compared to your styles, but gives me a solution with in 3 min real time. AS I don't have much exposure to IML and pitfalls of using it, I would really appreciate if you can provide me some feedback on my code (pasted below).

data in; infile cards; input id $3. v1 v2 v3; cards; 101 1 3 3 102 2 2 4 103 2 1 2 104 1 2 1 105 2 3 3 106 1 2 4 ; run;

proc transpose data = in out = in_t;run;

%let resp = 6; %let var = 3; %let data = in_t;

proc iml;

show space; use &data; read all into Y;

iter = 0; fc = shape(0,%eval(&resp*&var),&resp); summer = shape(0,&resp,&resp);

do i = 1 to &resp; do j = 1 to &resp; do k = 1 to &var; if Y[k,i] = Y[k,j] then fc[k+iter,j] = 1; end; end; iter = iter+&var; end;

do i = 1 to &resp; summer[i,] = fc[((i-1)*&var)+1:i*&var,][+,]; end;

create out from summer; append from summer;

quit;

Also, a very silly question...the code above works fine, but on the program editor the words 'do' and 'if' are appearing in red color...Any one has any idea? Its not hurting the result, but it looks strange!! Thanks guys.


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