I simply want to close a .sav File with syntax.
(The reason is a littly tricky: Thanks Jon Peck, but there is one problem left. If you just select cases -not permanent- and save the file with the selected cases, unfortunately all cases are saved and not only the selected. Maybe there is a possibility to save only selected files. As far as my capabilities in SPSS-Syntax are concerned you have to use "SELECT IF group =1." But that's permanent. So I need a syntax to close the 'old' file and open the original again.) Thank you
Dr. Frank Gaeth
|
Administrator
|
If you have only one active dataset, just open the file--the file on disk will replace the one you're working with. If you have multiple datasets on the go, use DATASET CLOSE. See examples in the Help.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
In reply to this post by drfg2008
If what you want is to save subsets of
cases without discarding them from the active dataset, do this.
temporary. select if ... save outfile=... If you want to partition your dataset according to the values of one or more splitting variables, you might consider the SPSSINC SPLIT DATASET extension command. Jon Peck Senior Software Engineer, IBM [hidden email] 312-651-3435 From: drfg2008 <[hidden email]> To: [hidden email] Date: 02/21/2011 03:37 PM Subject: [SPSSX-L] close a file (.sav) with syntax) Sent by: "SPSSX(r) Discussion" <[hidden email]> I simply want to close a .sav File with syntax. (The reason is a littly tricky: Thanks Jon Peck, but there is one problem left. If you just select cases -not permanent- and save the file with the selected cases, unfortunately all cases are saved and not only the selected. Maybe there is a possibility to save only selected files. As far as my capabilities in SPSS-Syntax are concerned you have to use "SELECT IF group =1." But that's permanent. So I need a syntax to close the 'old' file and open the original again.) Thank you ----- FUB -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/close-a-file-sav-with-syntax-tp3394752p3394752.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
Thanks, temporary worked!
Thanks also to "SPSSINC SPLIT DATASET extension command" I'm checking this right now. This is a working Syntax (with my more elementary version). But it's quite fast. *---- Split file and generate new files according to labels of a key variable --. *------------------------ generate Data (start) ------------------------------. input program. loop a =1 to 100000 by 1. end case. end loop. end file. end input program. exe. comp gruppe=RV.BINOM(10,0.5). COMP av_1=RV.NORMAL(1,10). COMP av_2=RV.NORMAL(1,10). COMP av_3=RV.NORMAL(1,10). COMP av_4=RV.NORMAL(1,10). EXECUTE . SAVE OUTFILE='C:\<path>\FILE_SPLITTEN.sav'. *--- End: generate Data --------------. *----- Start -------------------------. GET FILE='C:\<path>\FILE_SPLITTEN.sav'. DATASET NAME DatenSet1 WINDOW=FRONT. AUTORECODE VARIABLES=gruppe /INTO gruppe_codiert /PRINT. DATASET DECLARE anzahl_gruppen. AGGREGATE /OUTFILE='anzahl_gruppen' /BREAK=gruppe /N_BREAK=N. DATASET ACTIVATE anzahl_gruppen. BEGIN PROGRAM. import spss FileGROUPS=spss.GetCaseCount() spss.Submit("DATASET ACTIVATE DatenSet1.") for i in range(FileGROUPS): spss.Submit("temporary.") spss.Submit(" SELECT IF gruppe_codiert = " +str(i) +".") spss.Submit("SAVE OUTFILE='C:/<path>/gruppe_ " +str( i) + ".sav'") END PROGRAM.
Dr. Frank Gaeth
|
Free forum by Nabble | Edit this page |