SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  creating multiple tables with different conditions

    Posted Thu March 31, 2022 10:57 AM
    I am creating a number of means tables with bar graphs and custom tables from survey data in SPSS 28. I have to create the same tables and graphs for each individual department, so I am using the Select Cases condition to select only one department at a time. Is there a more efficient way to create these tables and graphs that are essentially the same (using the same variables)?

    ------------------------------
    C D
    ------------------------------

    #SPSSStatistics


  • 2.  RE: creating multiple tables with different conditions

    Posted Thu March 31, 2022 11:07 AM
    Hi. Look into the SPLIT FILES command. Sort by department, split the file, then run the MEANS or CTABLES commands, as you were.

    ------------------------------
    Rick Marcantonio
    Quality Assurance
    IBM
    ------------------------------



  • 3.  RE: creating multiple tables with different conditions

    Posted Thu March 31, 2022 11:17 AM
    SPLIT FILES is designed for this situation, but it applies the splits within each procedure.  So if the report runs multiple procedures for each department, which it seems that it does, and you want the output grouped by department or even in separate output files, SPLIT FILES would leave you with a lot of rearranging to do.

    In that case, the SPSSINC SPLIT DATASET and SPSSINC PROCESS FILES extension commands would be appropriate.  SPLIT DATASET would make a separate sav file for each department's data, and PROCESS FILES would iterate over those files producing the output for each department either grouped sequentially by department or in separate spv files.  The processing could include exporting in whatever final format you need.

    These commands can be installed via the Extensions > Extension Hub menu.  The first time you use PROCESS FILES, it will take a bit of time to get the hang of it, but it will save you a lot of manual work.

    --





  • 4.  RE: creating multiple tables with different conditions

    Posted Thu April 07, 2022 11:14 AM
    Thank you! Both were great suggestions. I'm running reports now with SPLIT FILES and it is working. I would really like to utilize PROCESS FILES but don't quite have it working. Are there any tutorials available? I can't find much information on that command. Thanks again!

    ------------------------------
    C D
    ------------------------------



  • 5.  RE: creating multiple tables with different conditions

    Posted Thu April 07, 2022 11:33 AM
    There are no tutorials for PROCESS FILES, but the syntax help for the procedure, which you can get by pressing F1 with the cursor on an instance of the command, has some examples that may be helpful.

    A common misunderstanding with that command is that you have to include the command for opening the input data in the syntax you run with it.  PROCESS FILES defines a file handle (and a macro) that refers to the data file as well as other items.

    The file handles are as follows.

    • JOB_INPUTFILE: The input file, including any directory path specified
    • JOB_DATADIR: The input data directory
    • JOB_OUTPUTDATADIR: The specified output data directory or <NONE>
    • JOB_VIEWERDIR: The specified Viewer output directory or <NONE>

    For a SAV file you could read the data with the command
    GET FILE="JOB_INPUTFILE".

    So you would typically start your syntax file with that GET command or whatever syntax you need to read the file.  


    --