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 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 4 Nov 2005 13:36:27 -0500
Reply-To:     Jay Weedon <jweedon@EARTHLINK.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jay Weedon <jweedon@EARTHLINK.NET>
Organization: http://newsguy.com
Subject:      Re: replacing variables in one data step with variables in another
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=us-ascii

On 4 Nov 2005 09:45:57 -0800, nextgenoctavius@gmail.com wrote:

>Hey, >I've been working on this data set for a couple weeks now and cannot >seem to stumble on a way of getting sas to do what i want. Basically >what i have is the following: >data set 1: > >team wk9 wk10 wk11 wk12 wk13 .... wk17 > >Ari Sea Det StL Jac SFO >Atl Mia GBP TBB Det Car >Bal Cin Jac Pit Cin Hou >Buf . KCC SDC Car Mia >Car TBB NYJ Chi Buf Atl >Chi NOS SFO Car TBB GBP >Cin Bal . Ind Bal Pit >Cle Ten Pit Mia Min Jac >Dal . Phi Det Den NYG >. >. >. >Was > >so what i have in the first col is the Team and then in the remaining >cols the remaining teams to be played. ( the . denotes a bye) the >tricky part is I have numerical values assosciated with each team > >data set 2: > >Ari 5.842857 >Atl 7.814286 >Bal 6.392857 >. >. >. >Was 4.471429 > > >What I want to do is replace each team in the wk9-wk17 columns with >the numerical value assosciated to each team. The numerical value >changes from week to week, so I want it to refer to the data set that >has the numerical values stored in it. > >Technically it doesnt have to be done the way i described, effectively >i just need a sum of the numerical values of remaning opponents for >each of the teams if you know of a different way of doing that.

data _null_; * Copy scores from set two into macro variables with team names (I assume set 2 variable names to be TEAM & SCORE); set two; call symputn(team,score); run;

data new; * Read set one & copy scores into new vars score9-score17; set one; array wk wk9-wk17; array score score9-score17; do over wk; if wk^=' ' and symexist(wk) then score=symgetn(wk); end; run;

JW


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