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 (November 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 28 Nov 2009 10:29:16 -0600
Reply-To:     "Data _null_;" <iebupdte@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Data _null_;" <iebupdte@GMAIL.COM>
Subject:      Re: Converting SAS code
Comments: To: Håkan Lane <hlane@cls.dk>
In-Reply-To:  <20091128164437.22744ka2zeyfic85@webmail.nfit.au.dk>
Content-Type: text/plain; charset=ISO-8859-1

Maybe, you could improve the performance of your SAS algorithms. Sometimes very simple changes make significant performance improvement. Doing so would seem easier than rewriting in a new language. Poorly optimized algorithms probable run about the same speed in any language.

If you would tell the group about the overall process we could probably help you improve your existing SAS programs. The code snippet you supplied does not proved much information.

On 11/28/09, Håkan Lane <hlane@cls.dk> wrote: > We have reached a point where our SAS code is taking enormous > amounts of time to execute. The size of the data sets together with > the nature of the algorithms require days and almost weeks to > completion in some instances. My boss has therefore opened up the idea > of using high performance computing in other languages. > > How do you convert for example a merge command between three sets? I > paste a sample from one of the programs below to give you an idea of > some operations. Please add your ideas on how we can do this more > efficiently. > > DATA a(sgio=yes); > > LENGTH tmin tmax aar 3; /* tre bytes */ > > LENGTH cram $ 1; > > RETAIN tmin 0; > > > > SET libt.crami; /* pnr aar ugenr ugegrad ugears */ > > WHERE MOD(pnr, 10) = &pnrcif; > > > > BY pnr aar ugenr; > > > > IF first.aar THEN DO; > > tmin = ugenr; > > END; > > IF last.aar THEN DO; > > tmax = ugenr; > > /* cram = '1';*/ > > OUTPUT; > > END; > > KEEP pnr aar tmin tmax; > > /* indeholder: pnr aar tmin tmax cram */ > > PROC PRINT data=a(obs=500); > > run; > > > > /* laver en record for alle personer for alle ?r */ > > > > /* indeholder: pnr aar */ > > > > /* inds?tter status fra ida, beregner cramstatus for alle ?r og > beregner tmin/tmax for ?r med cram=0 */ > > DATA b(sgio=yes); > > LENGTH aar 3; > > MERGE libt.pnraar a(IN=cram1) libt.statusi (KEEP = pnr aar > status selvst alder); > > BY pnr aar; > > /*%include > '/data2/700730/spells/program/pnrfilter.sas';*/ > > WHERE MOD(pnr, 10) = &pnrcif; > > IF cram1=0 THEN DO; > > cram = '0'; > > tmin = 53; /* tmin s?ttes til den sidste uge i ?ret +1 */ > > IF aar IN (1986, 1992, 1997, 2003) THEN tmin = 54; > > tmax = 0; > > END; > > ELSE cram = '1'; > > > > /* antager, at manglende ida-oplysninger om status betyder, at > personen ikke er i arbejdsstyrken */ > > IF status = . THEN status = 0; > > IF selvst = . THEN selvst = 0; > > RUN; > > /* indeholder: pnr aar tmin tmax status cram */ > > > > DATA a; RUN; > > DATA pnraar; RUN; > > > > /* beregner nu arbejdsstilling og cramstatus for foreg?ende ?r */ > > DATA c(sgio=yes); > > LENGTH tmaxprev statprev aar 3; > > RETAIN tmaxprev 0; > > RETAIN statprev 0; > > RETAIN cramprev '0'; > > RETAIN selvstprev 0; > > > > SET b; > > tmaxprev = lag(tmax); > > statprev = lag(status); > > cramprev = lag(cram); > > selvstprev = lag(selvst); > > > > IF aar = 1985 THEN DO; /* tilstand for 1984 s?ttes lig > tilstand > for 1985 */ > > tmaxprev=tmax; > > statprev=status; > > cramprev=cram; > > selvstprev=selvst; > > END; > > RUN; >


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