|
Hello,
I would like to use a macro to save several smaller datasets from one big dataset. I need to break the data out based on a category variable and then save the new dataset using the name of the category and the administration month. Here is how the data are structured: ID Var1 Var2 Var3 ...... Var15 Category Administration 1 3.5 4.25 2.11 ....... 4.23 00002 February 2 2.35 2.11 4.67 ....... 3.23 00002 February 3 1.5 4.65 3.51 ....... 1.23 00015 February 4 4.15 4.25 2.78 ....... 3.78 00015 February . . . I need 2 data files containing all the variables (Var1-Var15), 1 data file containing cases 1 and 2 named 2014_00002_February.sav and 1 containing cases 3 and 4 names 2014_00015_February.sav Thank you! Jenny |
|
The SPSSINC SPLIT DATASET extension command
will do this for you. You can specify the splitting variables and
whether output file names are based on values or value labels. Sorting
of the dataset is not required.
This extension command requires the Python Essentials. The Essentials are available via the SPSS Community website (www.ibm.com/developerworks/spssdevcentral) or the product materials, depending on your Statistics version. SPLIT DATASET is available from the Extensions Commands collection on that site or directly via Utilities > Extension Bundles > Download and Install Extension Bundles with Statistics 22. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: j_pav <[hidden email]> To: [hidden email], Date: 03/04/2014 09:04 AM Subject: [SPSSX-L] saving multiple datasets using macros Sent by: "SPSSX(r) Discussion" <[hidden email]> Hello, I would like to use a macro to save several smaller datasets from one big dataset. I need to break the data out based on a category variable and then save the new dataset using the name of the category and the administration month. Here is how the data are structured: ID Var1 Var2 Var3 ...... Var15 Category Administration 1 3.5 4.25 2.11 ....... 4.23 00002 February 2 2.35 2.11 4.67 ....... 3.23 00002 February 3 1.5 4.65 3.51 ....... 1.23 00015 February 4 4.15 4.25 2.78 ....... 3.78 00015 February . . . I need 2 data files containing all the variables (Var1-Var15), 1 data file containing cases 1 and 2 named 2014_00002_February.sav and 1 containing cases 3 and 4 names 2014_00015_February.sav Thank you! Jenny -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/saving-multiple-datasets-using-macros-tp5724718.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 |
| Free forum by Nabble | Edit this page |
