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 (January 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 22 Jan 2010 12:49:02 +0100
Reply-To:     Daniel Fernández <fdezdan@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Daniel Fernández <fdezdan@GMAIL.COM>
Subject:      Re: Lag function-quarterly data
Comments: To: SAS user <sasuser4@googlemail.com>
In-Reply-To:  <20e5d12f1001220329p508e73bfoaa40b51d6f44dc92@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

If you want to compare one quarter with last quarter, this is a possile solution:

proc sort data =have out=need; by id yearqtr;run;

data need2; do until (last.id); set need end=fin; by id yearqtr ; output; var1_last_qtr= variable1; var2_last_qtr= variable2; end; if first.id then do; var1_last_qtr= .; var2_last_qtr= .; end; run;

Daniel Fernandez. Barcelona

El día 22 de enero de 2010 12:29, Daniel Fernández <fdezdan@gmail.com> escribió: > hi, > > how mnay lags you want? Do you compare 1974Q3 to 1974Q2 ? Or 4 quarters a year? > > Daniel > > 2010/1/22 SAS user <sasuser4@googlemail.com>: >> Here is a sample of my data; I have around 600,000 observations >> ID yearqtr variable1 variable2 >> 006 1974Q4 200 300 >> 006 1974Q3 100 153 >> 006 1974Q2 360 256 >> 006 1974Q1 256 369 >> 006 1975Q4 369 257 >> 006 1975Q3 596 589 >> 006 1975Q2 965 125 >> 006 1975Q1 259 789 >> 005 >> >> >> etc >> >> >> >> 004 >> >> etc >> Any suggestions will be greatly appreciated. >> >


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