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 2003)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 18 Jul 2003 09:48:01 +0300
Reply-To:     MLiberts@csb.gov.lv
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         MLiberts@csb.gov.lv
Subject:      Re: Creating multiple files based on different time periods
Comments: To: "Paparodopoulos, Nikos" <NPaparodopoulos@ing.gr>
Content-type: text/plain; charset=us-ascii

Hi Niko,

There is the macro:

define !split(). !do !year=1995 !to 2005. get file="C:\temp\temp.sav". select if xdate.year(date1)=!year. save outfile=!quote(!concat("C:\temp\temp",!year,".sav")). !doend. !enddefine.

!split.

Martins

-- Martins Liberts Central Statistical Bureau of Latvia address: Lacplesa iela 1, Riga, LV-1301, Latvia phone: 371-7366877 email: mliberts@csb.gov.lv

"Paparodopoulos, Nikos" To: SPSSX-L@LISTSERV.UGA.EDU <NPaparodopoulos cc: @ing.gr> Subject: Creating multiple files based on different time periods Sent by: "SPSSX(r) Discussion" <SPSSX-L@LISTSER V.UGA.EDU>

17.07.2003 18:37 Please respond to "Paparodopoulos, Nikos"

Andrew thanks a lot. Your solution helped me to proceed.

I need to repeat the below mentioned task for more than 10 times (which I believe is the limit for XSAVe comand in a session).

Is it possible to do it by a MACRO? Any help in preparing that MACRO would be much appreciated.

Thanks in advance

Nikos

===========================================================================

=================== -----Original Message----- From: Andrew Fenyo [mailto:A.J.Fenyo@kent.ac.uk] Sent: Thursday, July 17, 2003 1:11 PM To: Paparodopoulos, Nikos Subject: RE: Creating multiple files based on different time periods

Nikos,

This should do the trick:

do if date1 < date.dmy(1,1,1998). xsave outfile='c:\1997.sav'. else if date1 < date.dmy(1,1,1999). xsave outfile='c:\1998.sav'. else if date1 < date.dmy(1,1,2000). xsave outfile='c:\1999.sav'. else if date1 < date.dmy(1,1,2001). xsave outfile='c:\2000.sav'. end if. exec.

Andrew

============================== Andrew Fenyo, Senior Computing Officer Personal Social Services Research Unit University of Kent, Canterbury, CT2 7NF Voice: 01227 827610 Fax: 01227 827038 PSSRU: http://www.pssru.ac.uk

Treasurer, ASSESS - the SPSS User Group http://spssusers.co.uk ===========================================================================

================

Dear List,

I have a file with one variable (VAR1) and corresponding Beginning (DATE1) & Ending (DATE2) Dates as follows:

VAR1 DATE1 DATE2 23 2-JUN-1998 31-DEC-1998 11 14-AUG-1999 25-OCT-1999 09 5-FEB-1997 5-FEB-1998 16 7-MAY-1999 1-MAR-1999 23 2-JUN-1998 31-DEC-1998 06 9-MAY-1997 3-SEP-1997 12 12-APR-1999 1-MAR-2000 45 27-JUN-1998 11-MAY-1999 33 7-JAN-2000 6-NOV-2000

I want to "trap" cases according to predefined time periods, say '1-JAN-1997' to '1-JAN-1998' '1-JAN-1998' to '1-JAN-1999' '1-JAN-1999' to '1-JAN-2000'

if DATE1 falls within the above predefined time periods.

I would also like to have the output for each "case trapping" on a different file.

Any help would be much appreciated.

Regards

Nikos Paparodopoulos


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