LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 17 Apr 2007 16:54:50 -0400
Reply-To:     "data _null_;" <datanull@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "data _null_;" <datanull@GMAIL.COM>
Subject:      Re: SAS First. Question
Comments: To: bruce.b.allen@wellsfargo.com
In-Reply-To:  <49C7ADC95F79CE418183D8756EB67F5D0436E2E8@msgswbmnmsp03.wellsfargo.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

I can't tell what your input is and desired output.

However if the variables listed on this retain statement retain volume_rem hits total_hits; exist in the data being SET the RETAIN will have no effect.

Can you better describe the input and output desired? With example data.

Sorry to be so dense.

On 4/17/07, Bruce Allen <bruce.b.allen@wellsfargo.com> wrote: > I have a table that I am trying to add variables called volume_rem, hits > and total_hits. An example of the table would be below: > > FIPS rank model rate Volume volume_rem hits > total_hits > 1117 1 HVE 0.66667 446 446 297 297 > 1117 2 CMV 0.5 446 0 0 0 > 1117 3 PASS2 0.75 446 0 0 0 > 1123 1 CMV 1 60 60 60 60 > 1123 2 HVE 1 60 0 0 0 > 1125 1 CMV 1 165 165 165 165 > 1127 1 HVE 0.5 40 40 20 20 > 2020 1 CASA 0.69333 1971 1971 1367 1367 > 2020 2 HVE 0.85333 1971 0 0 0 > 2110 1 HVE 0.57895 491 491 284 284 > 4001 1 HVE 1 65 65 65 65 > 4003 1 VV 0.65517 953 953 625 625 > 4003 2 VP4 0.7931 953 0 0 0 > 4003 3 HVE 0.75862 953 0 0 0 > > That's the data I get with this code: > data avm.wfhm_hits_bba; > set avm.master_wfhm; > > format volume_rem $8.; > format hits $8.; > format total_hits $8.; > > by fips; > if first.fips then > do; > volume_rem = volume - total_hits; > hits = volume_rem * rate; > total_hits = total_hits + hits; > end; > else > do; > volume_rem = volume_rem - total_hits; > hits = volume_rem * rate; > total_hits = total_hits + hits; > end; > retain volume_rem hits total_hits; > > run; > > What I am trying to do is do like a running total sort of. I've tried > to use the retain statement so that I could reference the previous > record to do the math on the current record but it doesn't seem to be > working. > > Any thoughts.... > > Bruce Allen > Settlement Services Group > Wells Fargo Home Mortgage > 952.562.1701 > bruce.b.allen@wellsfargo.com > > >


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