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 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 16 Dec 2004 17:50:04 -0800
Reply-To:     "Pardee, Roy" <pardee.r@GHC.ORG>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Pardee, Roy" <pardee.r@GHC.ORG>
Subject:      Re: colonoscopy gone awry
Comments: To: Michael Murff <mjm33@MSM1.BYU.EDU>
Content-Type: text/plain; charset="us-ascii"

[Best subject line ever.]

proc sql ; * describe table dictionary.columns ; select name into :NonRightVars separated by ', ' from dictionary.columns where upcase(libname) = "MYDATA" and upcase(memname) = "D1" and upcase(name) not in ('HAND1', 'HAND2', 'GENDER', 'ENERGY', 'MOTION1', 'MOTION2') ;

create table data mydata.fullmat as select &NonRightVars , hand1, hand2, gender, energy, motion1, motion2 from mydata.d1 ; quit ;



-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Michael Murff Sent: Thursday, December 16, 2004 3:01 PM To: SAS-L@LISTSERV.UGA.EDU Subject: colonoscopy gone awry


Let's say I have a very wide dataset and need to pluck out 5 variables that are dispersed in various unknown column positions. The program that I'm going to run (Proc IML) requires that its input matrix be organized with the extension variables clumped as the rightmost five columns. I wrote the following code to do the task, but as you can see, a rather large dataset (500 MB) must be read four times! I am hopping there may be a more efficient (computing time and code brevity, though the former is more important) way. I tried to use a retain statement with the colon modifier, e.g., retain a: b: c: d: e:, where a-e are the first letter of each group of core variables which must be "left justified." The colon appears to have no effect, though when I use retain with actual variable names it does move vars to "leftwise" in the PDV. Can anyone do this with just one pass (okay, no more than two) through the data? Any thoughts would be appreciated.

Michael Murff Provo, UT

data mydata.extensions; set mydata.d1(keep=hand1 hand2 gender energy motion1 motion2); run;

data mydata.core; set mydata.d1(drop=hand1 hand2 gender energy motion1 motion2 id); run;

data mydata.fullmat; set mydata.core; set mydata.extensions; run;

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