I want to plot the percent (or mean) of a 0,1 variable, call it ‘x’, by a categorical variable, year, using the graph command and I’m stuck on how to do it. IT seems trivial to do but I don’t understand it.
(I want to stay out of ggraph because the even though examples are presented everything is complex.) Gene Maguin |
I just use the GUI till I figure out the syntax. Pretty sure
GRAPH /BAR(SIMPLE)=MEAN(X) BY Year. does what you want Gene. ***************************. DATA LIST FREE / Year X. BEGIN DATA 2010 0 2010 1 2010 1 2011 0 2011 0 2011 0 2012 1 2012 1 2012 1 2012 0 2013 1 2014 0 2014 1 END DATA. DATASET NAME Sim. EXECUTE. GRAPH /BAR(SIMPLE)=MEAN(X) BY Year. ***************************. ----- Andy W [hidden email] http://andrewpwheeler.wordpress.com/ -- Sent from: http://spssx-discussion.1045642.n5.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 |
Andy, Thank you.
-----Original Message----- From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Andy W Sent: Thursday, May 13, 2021 12:38 PM To: [hidden email] Subject: Re: graph command help I just use the GUI till I figure out the syntax. Pretty sure GRAPH /BAR(SIMPLE)=MEAN(X) BY Year. does what you want Gene. ***************************. DATA LIST FREE / Year X. BEGIN DATA 2010 0 2010 1 2010 1 2011 0 2011 0 2011 0 2012 1 2012 1 2012 1 2012 0 2013 1 2014 0 2014 1 END DATA. DATASET NAME Sim. EXECUTE. GRAPH /BAR(SIMPLE)=MEAN(X) BY Year. ***************************. ----- Andy W [hidden email] http://andrewpwheeler.wordpress.com/ -- Sent from: http://spssx-discussion.1045642.n5.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 Maguin, Eugene
You can use the `graph /bar()` command in SPSS to do this. If your variable `x` is coded 0/1 and you want the mean (which is equivalent to percent of 1s), try:
GRAPH /BAR(GROUPED)=MEAN(x) BY year. This will give you the mean of `x` for each category of `year`. If you need it as percentages, you might consider computing a new variable or formatting the y-axis accordingly. Se invece stai cercando un modo per rappresentare i tuoi dati con stile anche fuori dal contesto statistico, puoi dare un’occhiata a questi bellissimi vestidos perfetti per qualsiasi occasione. |
Free forum by Nabble | Edit this page |