One solution would be to convert these macros into Python code, which can handle GGRAPH. I can't say whether that would be easy or hard without seeing the code, but I could take a look if you want to consider that.

--

Original Message:

Sent: 2/10/2024 5:52:00 AM

From: Frank Furter

Subject: RE: GRAPH command: denominator for percentages

Hi David,

thank you for your message - I am fully aware that this can be done in GGRAPH. The trouble is that I use quite a lot of SPSS macros (and I have a nice, little library) for repetitive tasks, and the GGRAPH does not run inside a DEFINE ... !ENDDEFINE structure. This is very unfortunate ...

------------------------------

Frank Furter

------------------------------

Original Message:

Sent: Fri February 09, 2024 12:51 PM

From: David Dwyer

Subject: GRAPH command: denominator for percentages

Hi @Frank Furter,

You are correct. The GRAPH command and the associated legacy graphs (Graph -> Bar) menus do not give you that level of granularity.

By contrast, the GGRAPH command and associated Chart Builder graphs (Graphs -> Chart Builder -> Bar) do give you a choice for the percentages reported.

The GRAPH command is giving you the third type of graph in that GGRAPH dropdown - "Total for Each Legend Variable Category (same fill color)"

I suspect what you want is one of the other two. Attached is output and the GGRAPH command that created it (I took the options for the denominator in order when I created these graphs).

I hope this helps,

------------------------------

David Dwyer

SPSS Technical Support

IBM Software

Original Message:

Sent: Thu January 25, 2024 07:34 AM

From: Frank Furter

Subject: GRAPH command: denominator for percentages

Using the GRAPH command (*not* GGRAPH) for generating a stacked bar chart, how can I specify the denominator for computing percentages?

Background: I would like to create a stacked bar graph that shows the percent frequency of categories within subgroups defined by the variable on the x-axis. My subroups have different numbers of subjects. In order to compare the relative frequencies in the categories, the cumulative percentage in each stack should be 100%, i.e., the denominator should be the total nmumber of cases in each category on the x-axsis. I would like to use the GRAPH command for this because, contrary to GGRAPH, it can be conveniently integrated into SPSS define ... !enddefine macros (no, I do *not* want to re-program all my stuff in Python ...).

Moreover, I'm not sure which denominator GRAPH actually uses: stacks have different sizes, and the cumulatrive percentage within each stack often exceeds 100%. What is this supposed to mean?

------------------------------

Frank Furter

------------------------------