I have data on almost 100 agencies, located in 8
Regions. Each agency has one of three program types. I want to produce a report (using SUMMARIZE) organized by
region by program type. That is, I want the report for Region 1 for
Program types 1 to 3, followed by Region 2, program types 1-3, …
Region 8, program types 1-3. The variables of interest are located in different
variables for the 3 program types. I tried using SPLIT FILE on Region, but that produced a
report organized by program type by region, i.e., separate results for each of
the 8 regions for program type 1, followed by the results for each of the 8
regions for program type 2 and then the results for each of the 8 regions for
program type 3. this necessitated a lot of flipping back and forth In order to
see what was happening in each region. I have been able to produce the reports by creating the
syntax for Region 1 (by filtering on Region 1), running it, saving the
output, editing the syntax to select Region 2, running it, etc. This is, of
course, time consuming and error prone and does not generate an audit trail. Any suggestions as to how to automate this would be
appreciated. Pat +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Here’s the syntax that I’ve been using. *Program Type 1 USE ALL. COMPUTE filter_$=(Region=8 & Program_Type=1). VARIABLE LABELS filter_$ 'Program_Type=1 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMATS filter_$ (f1.0). FILTER BY filter_$. SUMMARIZE /TABLES=AgencyName Q7_7b Q7_8b Q19_1a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. *===================================. * Program Type 2. USE ALL. COMPUTE filter_$=(Region=8 & Program_Type=2). VARIABLE LABELS filter_$ 'Program_Type=2 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMATS filter_$ (f1.0). FILTER BY filter_$. SUMMARIZE /TABLES=AgencyName q33_7b q33_8b Q45_1a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. SUMMARIZE /TABLES=AgencyName q33_9b q33_10b Q46_1a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. *=====================================================. *Program Type 3. USE ALL. COMPUTE filter_$=(Region=8 & Program_Type=4). VARIABLE LABELS filter_$ 'Program_Type=5 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMATS filter_$ (f1.0). FILTER BY filter_$. SUMMARIZE /TABLES=AgencyName q59_7b q59_8b q70_1a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. SUMMARIZE /TABLES=AgencyName q59_9b q59_10b q70_3a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. SUMMARIZE /TABLES=AgencyName Q59_11b Q59_12b q71_1a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. SUMMARIZE /TABLES=AgencyName q59_13b q59_14b q71_3a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. |
Maybe you could just pivot the SUMMARIZE
tables. But if that isn't sufficient, this could be a case for
SPSSINC SPLIT DATASET and SPSSINC PROCESS FILES. With PROCESS FILES, you can run a batch of commands on each "split", i.e., data file rather than just one command with all the splits in it. So you could use the first command to make region datasets and then run a batch of commands over each one using PROCESS FILES. PROCESS FILES gives you control over whether each round produces a separate output file or whether all the results go into one. The command provides you with file handles and macros for each of the input files that you can use in your syntax. These commands are available from the SPSS Community at (www.ibm.com/developerworks/spssdevcentral) and require the Python programmability plugin. HTH, Jon Peck Senior Software Engineer, IBM [hidden email] 312-651-3435 From: "Cleland, Patricia (EDU)" <[hidden email]> To: [hidden email] Date: 03/02/2011 01:27 PM Subject: [SPSSX-L] help with creating a case summary report grouped by region by program type Sent by: "SPSSX(r) Discussion" <[hidden email]> I have data on almost 100 agencies, located in 8 Regions. Each agency has one of three program types. I want to produce a report (using SUMMARIZE) organized by region by program type. That is, I want the report for Region 1 for Program types 1 to 3, followed by Region 2, program types 1-3, … Region 8, program types 1-3. The variables of interest are located in different variables for the 3 program types. I tried using SPLIT FILE on Region, but that produced a report organized by program type by region, i.e., separate results for each of the 8 regions for program type 1, followed by the results for each of the 8 regions for program type 2 and then the results for each of the 8 regions for program type 3. this necessitated a lot of flipping back and forth In order to see what was happening in each region. I have been able to produce the reports by creating the syntax for Region 1 (by filtering on Region 1), running it, saving the output, editing the syntax to select Region 2, running it, etc. This is, of course, time consuming and error prone and does not generate an audit trail. Any suggestions as to how to automate this would be appreciated. Pat +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Here’s the syntax that I’ve been using. *Program Type 1 USE ALL. COMPUTE filter_$=(Region=8 & Program_Type=1). VARIABLE LABELS filter_$ 'Program_Type=1 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMATS filter_$ (f1.0). FILTER BY filter_$. SUMMARIZE /TABLES=AgencyName Q7_7b Q7_8b Q19_1a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. *===================================. * Program Type 2. USE ALL. COMPUTE filter_$=(Region=8 & Program_Type=2). VARIABLE LABELS filter_$ 'Program_Type=2 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMATS filter_$ (f1.0). FILTER BY filter_$. SUMMARIZE /TABLES=AgencyName q33_7b q33_8b Q45_1a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. SUMMARIZE /TABLES=AgencyName q33_9b q33_10b Q46_1a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. *=====================================================. *Program Type 3. USE ALL. COMPUTE filter_$=(Region=8 & Program_Type=4). VARIABLE LABELS filter_$ 'Program_Type=5 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMATS filter_$ (f1.0). FILTER BY filter_$. SUMMARIZE /TABLES=AgencyName q59_7b q59_8b q70_1a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. SUMMARIZE /TABLES=AgencyName q59_9b q59_10b q70_3a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. SUMMARIZE /TABLES=AgencyName Q59_11b Q59_12b q71_1a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. SUMMARIZE /TABLES=AgencyName q59_13b q59_14b q71_3a /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100 /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=COUNT. |
Administrator
|
In reply to this post by Cleland, Patricia (EDU)
Wouldn't this be much more manageable if you didn't have your variables of interest splattered all over the place in the file. Why not simply create 3 new variables which are created dependent upon your current filters, then just summarize these within your choice of split file logic? I am not sure why you would organize your data in the current manner. It makes life a living hell whenever you need to do any sort of comparative analysis.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
As the Dutch proverb says, "Too soon old, too late wise".
Here's how I ended up with this complicated design. In the pilot test phase, I discovered that some agencies could answer in terms of their overall program. Others were clear that their programs, for example for youth and adults, were sufficiently different that they were unable to answer in terms of the agency as a whole and the questions had to be repeated for each program type. Some agencies went one step further and said that they had in effect 4 programs (age group by gender) requiring separate versions of the question for each program. The problem is that this means that the number of questions for each topic, such as the maximum number of clients in the program ranges from 1 to 4. For example, single program agencies respond to Q7_7b (maximum number of clients), two program agencies respond to Q33_7b and Q33_9b (maximum number of youth clients, maximum number of adult clients) and 4 program agencies to Q59_7b, Q59_9b, Q59_11b, and Q59_13b (maximum number of youth clients-male, maximum number of youth clients-female, maximum number of adult clients-male, maximum number of adult clients-female). There are questions about number of programs at the start of the survey that skips the respondent to the correct section. The analysis, as David suggests, has been extremely "challenging". I've created a set of 'crosswalks' documents so that I can see what questions correspond to what other questions. Just to add one more confusion, the survey was administered in more than one language depending on the language of the agency. However, the questions align across languages (with a few exceptions, such as culturally specific program components), that is, q7_7b is the same question in all languages. Any suggestions as to how I could have set this up better in the first place would be appreciated in case I have to do this again. Pat -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of David Marso Sent: March 3, 2011 4:01 PM To: [hidden email] Subject: Re: [SPSSX-L] help with creating a case summary report grouped by region by program type Wouldn't this be much more manageable if you didn't have your variables of interest splattered all over the place in the file. Why not simply create 3 new variables which are created dependent upon your current filters, then just summarize these within your choice of split file logic? I am not sure why you would organize your data in the current manner. It makes life a living hell whenever you need to do any sort of comparative analysis. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/help-with-creating-a-case- summary-report-grouped-by-region-by-program-type-tp3407087p3408631.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 ===================== 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 |
In reply to this post by Cleland, Patricia (EDU)
CONTENTS DELETED
The author has deleted this message.
|
Free forum by Nabble | Edit this page |