A client has this situation:
About 200 files over which we have to run a syntax. All the files are named after the subject number, e.g. 10001_R4.sav The syntax starts with opening the file, e.g. GET FILE="H:\10001_R4.sav". Then there are several analyses and next we save the file, e.g. OUTFILE="H:\10001_G4.sav" (thus, under a different name: R4->G4) They currently have to change the name every time we want to run the syntax; replace 10001 by 10002 to get the next file (we use ctrl H, find and replace). Does anyone know if there is some sort of loop function which allows us to automatically change and run the syntax? Thanks for the help! ================ Tks, Will
Will
Statistical Services ============ info.statman@earthlink.net http://home.earthlink.net/~z_statman/ ============ |
Hi Will,
look on Ray's site, spsstools.net, there is a macro that might help you: http://spsstools.net/Syntax/WorkingWithManyFiles/RunMacroOnSeveralFiles.txt Hhope it helps. Best wishes, Vlad. On 3/3/07, Will Bailey [Statman] <[hidden email]> wrote: > > A client has this situation: > > About 200 files over which we have to run a syntax. All the files are > named > after the subject number, e.g. 10001_R4.sav > > The syntax starts with opening the file, e.g. GET FILE="H:\10001_R4.sav". > Then there are several analyses and next we save the file, e.g. > OUTFILE="H:\10001_G4.sav" (thus, under a different name: R4->G4) > > They currently have to change the name every time we want to run the > syntax; > replace 10001 by 10002 to get the next file (we use ctrl H, find and > replace). > > Does anyone know if there is some sort of loop function which allows us to > automatically change and run the syntax? Thanks for the help! > ================ > > Tks, > Will > -- Vlad Simion Data Analyst Tel: +40 720130611 |
In reply to this post by zstatman
This kind of thing is very easy to do with programmability. There is an example in my PowerPoint presentation on SPSS 14 programmability that is available on SPSS Developer Central (www.spss.com/devcentral). That example discovers all the sav files in a directory and merges them. It is easy to specify a file pattern and then iterate over the set of files that match it.
I can provide more help if you want to go that route. -Jon Peck -----Original Message----- From: SPSSX(r) Discussion on behalf of Will Bailey [Statman] Sent: Sat 3/3/2007 7:29 AM To: [hidden email] Subject: [SPSSX-L] Multiple Files to Open & Analyze A client has this situation: About 200 files over which we have to run a syntax. All the files are named after the subject number, e.g. 10001_R4.sav The syntax starts with opening the file, e.g. GET FILE="H:\10001_R4.sav". Then there are several analyses and next we save the file, e.g. OUTFILE="H:\10001_G4.sav" (thus, under a different name: R4->G4) They currently have to change the name every time we want to run the syntax; replace 10001 by 10002 to get the next file (we use ctrl H, find and replace). Does anyone know if there is some sort of loop function which allows us to automatically change and run the syntax? Thanks for the help! ================ Tks, Will |
Thanks Jon, I looked there but missed it
W -----Original Message----- From: Peck, Jon [mailto:[hidden email]] Sent: Saturday, March 03, 2007 10:06 AM To: Will Bailey [Statman]; [hidden email] Subject: RE: [SPSSX-L] Multiple Files to Open & Analyze This kind of thing is very easy to do with programmability. There is an example in my PowerPoint presentation on SPSS 14 programmability that is available on SPSS Developer Central (www.spss.com/devcentral). That example discovers all the sav files in a directory and merges them. It is easy to specify a file pattern and then iterate over the set of files that match it. I can provide more help if you want to go that route. -Jon Peck -----Original Message----- From: SPSSX(r) Discussion on behalf of Will Bailey [Statman] Sent: Sat 3/3/2007 7:29 AM To: [hidden email] Subject: [SPSSX-L] Multiple Files to Open & Analyze A client has this situation: About 200 files over which we have to run a syntax. All the files are named after the subject number, e.g. 10001_R4.sav The syntax starts with opening the file, e.g. GET FILE="H:\10001_R4.sav". Then there are several analyses and next we save the file, e.g. OUTFILE="H:\10001_G4.sav" (thus, under a different name: R4->G4) They currently have to change the name every time we want to run the syntax; replace 10001 by 10002 to get the next file (we use ctrl H, find and replace). Does anyone know if there is some sort of loop function which allows us to automatically change and run the syntax? Thanks for the help! ================ Tks, Will
Will
Statistical Services ============ info.statman@earthlink.net http://home.earthlink.net/~z_statman/ ============ |
In reply to this post by zstatman
Hi Will,
If you are using ver. 14 or better, the programmability option simplifies what you are trying to do. In ver. 14.01 (version 15 has it built in) you will need to download the integration package, (available from SPSS' website), the Python (freeware) from their website, the modules from SPSS' website, load everything following programmability directions available on SPSS' site, and you should be good to go. I was facing the same knotty problem, and with help from Jon Peck and John Bauer was up and running very shortly thereafter. HTH Mike -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Will Bailey [Statman] Sent: Saturday, March 03, 2007 8:29 AM To: [hidden email] Subject: Multiple Files to Open & Analyze A client has this situation: About 200 files over which we have to run a syntax. All the files are named after the subject number, e.g. 10001_R4.sav The syntax starts with opening the file, e.g. GET FILE="H:\10001_R4.sav". Then there are several analyses and next we save the file, e.g. OUTFILE="H:\10001_G4.sav" (thus, under a different name: R4->G4) They currently have to change the name every time we want to run the syntax; replace 10001 by 10002 to get the next file (we use ctrl H, find and replace). Does anyone know if there is some sort of loop function which allows us to automatically change and run the syntax? Thanks for the help! ================ Tks, Will |
Free forum by Nabble | Edit this page |