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 (March 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 24 Mar 2006 08:53:48 -0500
Reply-To:     Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Subject:      Re: Selecting specific values from tables
Comments: To: daherhicham@HOTMAIL.COM

Hi Hicham,

Well, the way I would do it is (with data step): MERGE the two tables BY ERMNO, which adds the Date (actually Year) variable. Then depending on Date select a vlue from the corresponding Year variable to OUTPUT, possibly via an array. *Untested thoughts* (SAS server is down):

DATA Both (KEEP=ERMNO Value); MERGE Table3 Table4 ; * assumed sorted; BY ERMNO; ARRAY Year (1990:1994) V1990 V1991 V1992 V1993 V1994; * must start with letter; * I believe this is the syntax, but not sure, see ARRAY docs; IF (Date) THEN DO: Value = Year(Date); OUTPUT; END; RUN;

Regards - Jim. -- Jim Groeneveld, Netherlands Statistician, SAS consultant home.hccnet.nl/jim.groeneveld

On Fri, 24 Mar 2006 03:16:30 -0800, Hicham <daherhicham@HOTMAIL.COM> wrote:

>Thanks everyone for your help. I will try to give some examples about >my tables. >Table3 : > >ERMNO 1990 1991 1992 1993 1994 >10002 0 0 0 0 0 >10009 -98 -98 -98 -98 -98 >10020 -98 -98 -98 -98 -98 >10056 0 0 0 0 0 >10106 -98 -98 -98 10 -98 >10126 -98 -98 -98 -98 -98 >10157 -98 -4.5 -98 -98 -98 >10179 -2 -98 -98 -98 -98 > >Table4: >ERMNO Date >10106 1993 >10179 1990 >10009 1992 > >So i am looking to have a table as follows: > >ERMNO Value >10106 10 >10179 -2 >10009 -98 > >To resume, i am looking for a certain way to create the last table.


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