How to output tables when all values are 0

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to output tables when all values are 0

Nancy Rusinak-2
Hello,

My company has asked me to put together an Excel report that is easily refreshed weekly.  I have syntax to calculate and output a table for new hires for 2 specific areas. Some weeks there are no new hires. My ctables syntax leads to this output: “No cases were input to this procedure.  Either there are no cases in the working data file or all of them have been filtered out.”

I export my output to a worksheet in the Excel report.  The report charts reference cells my spss output so I’d like to have “0” in the appropriate cell when there are no new hires.  Would there be a way to have my output produce a table where the column heading is “Count” and there are two rows (for my two areas) with both containing a “0” when there are no new hires?

I’ve tried using the subcommand /FORMAT EMPTY=ZERO MISSING=‘.0’ but that isn’t getting me there.

Much thanks, all.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: How to output tables when all values are 0

Jon Peck
You have to have at least one case in the dataset for a procedure to run.  With no cases, CTABLES and other procedures are never even invoked, so no CTABLES code will help.

What you need to do is to set up your dataset with one case.  Your CTABLES code can specify the values to be tabulated, so as long as the case has a variable with a value not included in the table (based on the CATEGORIES subcommand) you would get a table with all zeros that could then be exported.

On Thu, Jun 17, 2021 at 1:57 PM Nancy <[hidden email]> wrote:
Hello,

My company has asked me to put together an Excel report that is easily refreshed weekly.  I have syntax to calculate and output a table for new hires for 2 specific areas. Some weeks there are no new hires. My ctables syntax leads to this output: “No cases were input to this procedure.  Either there are no cases in the working data file or all of them have been filtered out.”

I export my output to a worksheet in the Excel report.  The report charts reference cells my spss output so I’d like to have “0” in the appropriate cell when there are no new hires.  Would there be a way to have my output produce a table where the column heading is “Count” and there are two rows (for my two areas) with both containing a “0” when there are no new hires?

I’ve tried using the subcommand /FORMAT EMPTY=ZERO MISSING=‘.0’ but that isn’t getting me there.

Much thanks, all.

=====================
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


--
Jon K Peck
[hidden email]

===================== 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