|
Hi-
How can I make one syntax file that runs multiple other syntax files in succession? For example syntax files names syntax1, syntax2, syntax3 to be run in numerical order. Thanks, Brian |
|
Hi Brian
The INSERT COMMAND will do it. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Brian Moore Sent: Wednesday, October 10, 2007 3:06 PM To: [hidden email] Subject: Run Multiple Syntax Files Hi- How can I make one syntax file that runs multiple other syntax files in succession? For example syntax files names syntax1, syntax2, syntax3 to be run in numerical order. Thanks, Brian |
|
Thanks for your reply. The help menus went around in circles a bit
(which brought me to the list at first) but this solves it. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax.sps'. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax2.sps'. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax3.sps'. ******* For others interested - full paths are required (even if both files are in the same folder (unlike linked spreadsheets in excel for example). And the log file includes line numbers for the combined output [though mine didn't start with "1" oddly enough] <partial sample below> 659 660 * End of INSERT and INCLUDE nesting level 01. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\temp Syntax2.sps'. 661 662 663 GET 664 FILE='J:\Market Research Reports\TRAILS Report (mailing list'+ 665 ' tracking)\CustMatches_incNoOrderXprioritycode_eml.sav'. 666 DATASET NAME DataSet10 WINDOW=FRONT. Regards, Brian -----Original Message----- From: Edward Boadi [mailto:[hidden email]] Sent: Wednesday, October 10, 2007 12:12 PM To: Brian Moore; [hidden email] Subject: RE: Run Multiple Syntax Files Hi Brian The INSERT COMMAND will do it. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Brian Moore Sent: Wednesday, October 10, 2007 3:06 PM To: [hidden email] Subject: Run Multiple Syntax Files Hi- How can I make one syntax file that runs multiple other syntax files in succession? For example syntax files names syntax1, syntax2, syntax3 to be run in numerical order. Thanks, Brian |
|
INSERT does indeed allow you to run syntax files from another syntax file, but full paths are not required. If the file is in the SPSS backend working directory, you can use a relative path. You can also use something like
INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax.sps' CD=YES. That changes the working directory to the location of the inserted files so subsequent file specs to the same directory don't need to repeat the directory. Or you can use the command CD 'filespec'. to change the working directory and then use relative paths. These techniques can reduce the number of references in your code to locations that might change. And there is also the FILE HANDLE command that lets you define a symbolic reference to a file or location that you can use later in the job. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Brian Moore Sent: Wednesday, October 10, 2007 3:57 PM To: [hidden email] Subject: Re: [SPSSX-L] Run Multiple Syntax Files (solved) Thanks for your reply. The help menus went around in circles a bit (which brought me to the list at first) but this solves it. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax.sps'. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax2.sps'. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax3.sps'. ******* For others interested - full paths are required (even if both files are in the same folder (unlike linked spreadsheets in excel for example). And the log file includes line numbers for the combined output [though mine didn't start with "1" oddly enough] <partial sample below> 659 660 * End of INSERT and INCLUDE nesting level 01. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\temp Syntax2.sps'. 661 662 663 GET 664 FILE='J:\Market Research Reports\TRAILS Report (mailing list'+ 665 ' tracking)\CustMatches_incNoOrderXprioritycode_eml.sav'. 666 DATASET NAME DataSet10 WINDOW=FRONT. Regards, Brian -----Original Message----- From: Edward Boadi [mailto:[hidden email]] Sent: Wednesday, October 10, 2007 12:12 PM To: Brian Moore; [hidden email] Subject: RE: Run Multiple Syntax Files Hi Brian The INSERT COMMAND will do it. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Brian Moore Sent: Wednesday, October 10, 2007 3:06 PM To: [hidden email] Subject: Run Multiple Syntax Files Hi- How can I make one syntax file that runs multiple other syntax files in succession? For example syntax files names syntax1, syntax2, syntax3 to be run in numerical order. Thanks, Brian |
|
In reply to this post by Brian Moore-3
Minor clarification:
Full paths aren't actually required -- but relative paths may not be what you think they are, since they're relative to what SPSS currently thinks is the working directory; so full paths eliminate any confusion/ambiguity. You can use the CD commmand or the CD keyword on the INSERT command to change the working directory, making it possible to use relative paths on subsequent commands, as in: CD 'c:\thisdir\thatdir'. insert file='somefile.sps'. insert file='someotherfile.sps'. or insert file='c:\thisdir\thatdir\somefile.sps' CD=YES. insert file='someotherfile.sps'. You can also use the FILE HANDLE command to specify a directory path, and then use the handle name in place of the directory path in file specifications. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Brian Moore Sent: Wednesday, October 10, 2007 3:57 PM To: [hidden email] Subject: Re: Run Multiple Syntax Files (solved) Thanks for your reply. The help menus went around in circles a bit (which brought me to the list at first) but this solves it. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax.sps'. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax2.sps'. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax3.sps'. ******* For others interested - full paths are required (even if both files are in the same folder (unlike linked spreadsheets in excel for example). And the log file includes line numbers for the combined output [though mine didn't start with "1" oddly enough] <partial sample below> 659 660 * End of INSERT and INCLUDE nesting level 01. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\temp Syntax2.sps'. 661 662 663 GET 664 FILE='J:\Market Research Reports\TRAILS Report (mailing list'+ 665 ' tracking)\CustMatches_incNoOrderXprioritycode_eml.sav'. 666 DATASET NAME DataSet10 WINDOW=FRONT. Regards, Brian -----Original Message----- From: Edward Boadi [mailto:[hidden email]] Sent: Wednesday, October 10, 2007 12:12 PM To: Brian Moore; [hidden email] Subject: RE: Run Multiple Syntax Files Hi Brian The INSERT COMMAND will do it. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Brian Moore Sent: Wednesday, October 10, 2007 3:06 PM To: [hidden email] Subject: Run Multiple Syntax Files Hi- How can I make one syntax file that runs multiple other syntax files in succession? For example syntax files names syntax1, syntax2, syntax3 to be run in numerical order. Thanks, Brian |
|
In reply to this post by Peck, Jon
Hi all,
we use macros to reuse path and names. Our syntax programs work like this: DEFINE @path () 'H:\Strategy, Marketing and Market Research\Marketing Research\' !ENDDEFINE . DEFINE @syntax () 'Syntax.sps' !ENDDEFINE . INSERT FILE = @path + @syntax . If you use '/' instead of '\' you can use the path name in SPSS and with Python. Regards Georg Maubach -----Ursprüngliche Nachricht----- Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Peck, Jon Gesendet: Mittwoch, 10. Oktober 2007 23:18 An: [hidden email] Betreff: Re: Run Multiple Syntax Files (solved) INSERT does indeed allow you to run syntax files from another syntax file, but full paths are not required. If the file is in the SPSS backend working directory, you can use a relative path. You can also use something like INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax.sps' CD=YES. That changes the working directory to the location of the inserted files so subsequent file specs to the same directory don't need to repeat the directory. Or you can use the command CD 'filespec'. to change the working directory and then use relative paths. These techniques can reduce the number of references in your code to locations that might change. And there is also the FILE HANDLE command that lets you define a symbolic reference to a file or location that you can use later in the job. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Brian Moore Sent: Wednesday, October 10, 2007 3:57 PM To: [hidden email] Subject: Re: [SPSSX-L] Run Multiple Syntax Files (solved) Thanks for your reply. The help menus went around in circles a bit (which brought me to the list at first) but this solves it. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax.sps'. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax2.sps'. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\Syntax3.sps'. ******* For others interested - full paths are required (even if both files are in the same folder (unlike linked spreadsheets in excel for example). And the log file includes line numbers for the combined output [though mine didn't start with "1" oddly enough] <partial sample below> 659 660 * End of INSERT and INCLUDE nesting level 01. INSERT FILE='H:\Strategy, Marketing and Market Research\Marketing Research\temp Syntax2.sps'. 661 662 663 GET 664 FILE='J:\Market Research Reports\TRAILS Report (mailing list'+ 665 ' tracking)\CustMatches_incNoOrderXprioritycode_eml.sav'. 666 DATASET NAME DataSet10 WINDOW=FRONT. Regards, Brian -----Original Message----- From: Edward Boadi [mailto:[hidden email]] Sent: Wednesday, October 10, 2007 12:12 PM To: Brian Moore; [hidden email] Subject: RE: Run Multiple Syntax Files Hi Brian The INSERT COMMAND will do it. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Brian Moore Sent: Wednesday, October 10, 2007 3:06 PM To: [hidden email] Subject: Run Multiple Syntax Files Hi- How can I make one syntax file that runs multiple other syntax files in succession? For example syntax files names syntax1, syntax2, syntax3 to be run in numerical order. Thanks, Brian |
| Free forum by Nabble | Edit this page |
