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 (December 2007)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 20 Dec 2007 17:58:49 +0100
Reply-To:     la volta statistics <schmidhauser@lavolta.ch>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         la volta statistics <schmidhauser@lavolta.ch>
Subject:      AW: AW: automating syntax
Comments: To: Samuel Solomon <samuel.solomon@nso.gov.er>
In-Reply-To:  <BE3FA3B86F9D4643B1162B55FBB4FEA4057D30@exchange.nso.gov.er>
Content-Type: text/plain; charset="iso-8859-1"

Hi Samuel You are not particularly specific about what you want. Of course can the get file command be changed. You also can have different data file open when you have SPSS v14 (I think) or higher. You then need to set the the fiel active you want to work with. Look up Dataset ACTIVAte in the help. If you want to call it through a macro argument, you need to make a path such as you have it now for the save command. Use the Echo command to test your macro. I left you the Echo command in the macro as an example (*Echo !Path). Eventually you need to use the: New File. Dataset close all. after each saving. Hope this helps, Christian

* Start with something like that:

DEFINE !a (select = !CHAREND('/')). !DO !i !IN (!select).

!let !GPath =.(write here the path and the name of the file) *Echo !GPAth. get file =!GPAth..

!DOEND. !ENDDEFINE. !a select = '01200701jan' '02200702feb' '03200703mar' /.

-----Ursprüngliche Nachricht----- Von: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]Im Auftrag von Samuel Solomon Gesendet: Donnerstag, 20. Dezember 2007 15:53 An: SPSSX-L@LISTSERV.UGA.EDU Betreff: Re: AW: automating syntax

Dear Christian, Thanks it works but could you make it any general? Can I call different files in the 'get file' command at the same time. could you do it any other way. thanks

________________________________

From: SPSSX(r) Discussion on behalf of la volta statistics Sent: Thu 12/20/2007 5:10 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: AW: automating syntax

Hi Samuel try the following syntax. Hope this helps. Christian ******************************* la volta statistics Christian Schmidhauser, Dr.phil.II Weinbergstrasse 108 Ch-8006 Zürich Tel: +41 (043) 233 98 01 Fax: +41 (043) 233 98 02 email: mailto:schmidhauser@lavolta.ch internet: http://www.lavolta.ch/

New File. Dataset close all.

DEFINE !a (select = !CHAREND('/')). !DO !i !IN (!select). !let !m=!SUBSTR(!i,2,2). !let !Path = !QUOTE(!CONCAT("C:\FTS_MZ\indata01",!substr(!i,4,9),".sav")). *Echo !PAth. get file ='C:\indata01\indata01.sav'. select if month =!quote(!m). save outfile = !Path. !DOEND. !ENDDEFINE. !a select = '01200701jan' '02200702feb' '03200703mar' /.

-----Ursprüngliche Nachricht----- Von: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]Im Auftrag von Samuel Solomon Gesendet: Donnerstag, 20. Dezember 2007 09:33 An: SPSSX-L@LISTSERV.UGA.EDU Betreff: automating syntax

Dear all, I have a syntax which needs to be automated via macro. I wish to select cases from the variable month which is populated by 01,02,03,04,05,06,07,08,09,10,11,12 and save them as 200701jan.sav,200702feb.sav,200703mar.sav,,,,,,200712dec,,,,respectively, where the data 200701jan.sav is only populated by cases where month=01.. and so on.

I tried this ,but it pops up errors which I fail to comprehend. DEFINE !a (select=!CHAREND('/')). !let !m=!SUBSTR(!s,1,2). !let !p=!substr(!s,3,9). !DO !s !IN (!select) get file ='C:\indata01.sav'. select if month =!quote(!m). save outfile = !QUOTE(!CONCAT('C:\FTS_MZ\indata01',!substr(!p,1,2),'.sav')). !DOEND. !ENDDEFINE. !a select = 01200701jan 02200702feb 03200703mar /.

I need your help. thanks, Samuel.

======= To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

======= To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


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