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 (July 2004)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 6 Jul 2004 19:42:44 -0400
Reply-To:   Raynald Levesque <rlevesque@videotron.ca>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Raynald Levesque <rlevesque@videotron.ca>
Subject:   Re: date coding syntax (self-updating)
In-Reply-To:   <200407062257.i66Mv5724392@mail014.syd.optusnet.com.au>
Content-type:   text/plain; charset=US-ASCII

Hi

Try this:

COMPUTE quarters=(XDATE.YEAR(received) - 2002)*4 + XDATE.QUARTER(received).

Regards

Raynald Levesque rlevesque@videotron.ca Visit my SPSS site: http://pages.infinit.net/rlevesqu/

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Paul Dickson Sent: July 6, 2004 6:57 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: date coding syntax (self-updating)

Hi servers,

I am importing dates from excel that need to be coded into 4 lots of 3-monthly quarters. The periods are Jan1 to 31 March etc for four periods each year. The data is ongoing and needs to be updated on a regular basis. I have set up recoding that looks like the following but as soon an new dates come in, the recoding syntax needs to be re-adjusted because the most recent data from a new period are getting coded into the previous dates.

COMPUTE quarters=CTIME.DAYS(DATE.DMY(30,6,2004) - received)/365.25. IF (quarters >=2.2587268993 & quarters <= 2.5 ) newquare = 1. IF (quarters >= 2.0068446269 & quarters <= 2.2587) newquare = 2. IF (quarters >=1.749 & quarters <= 2.00) newquare = 3. IF (quarters >=1.497604 & quarters <= 1.746749) newquare = 4. IF (quarters >=1.2511978096 & quarters <=1.4976039) newquare = 5. IF (quarters >= 1.0020 & quarters <= 1.248460) newquare = 6. IF (quarters >=.750 & quarters <= .999316) newquare = 7. IF (quarters >= .49828 & quarters <= .747434) newquare = 8. IF (quarters >= .0 & quarters <= .492814) newquare = 9. execute. VARIABLE LABELS newquare 'new quarters'. value labels newquare 1 'Jan-March(2002)' 2 'Apr-Jun(2002)' 3 'Jul-Sep(2002)' 4 'Oct-Dec(2002)' 5 'Jan-March(2003)' 6 'Apr-Jun(2003)' 7 'Jul-Sep(2003)' 8 'Oct-Dec2003' 9 'Jan-Mar(2004)'. execute.

Since the data is ongoingly coming in, any advice on how to develop syntax that will contine to update irrespective of the year would be much appreciated.

Regards Paul


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