|
I would like to show only the top 5 of 10 mean scores on a simple bar
chart using GPL. I have been able to get my data to sort using sort.statistic and I have been able to get my data to exclude certain categories. But I can't get my head around how to do both. Thanks for any help. Jim ===================== 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 |
|
AFAIK, You can only exclude categories on a scale by category value. You
could compute your means outside of ggraph and pass it only the top 5 mean scores. Here's an example: GET FILE='C:\Users\Vi\Documents\spss17 testing\world95.sav'. DATASET NAME original WINDOW=FRONT. DATASET DECLARE religion_gdp. AGGREGATE /OUTFILE='religion_gdp' /BREAK=religion /gdp_cap=MEAN(gdp_cap). DATASET ACTIVATE religion_gdp. sort cases by gdp_cap(d). n of cases 5. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=religion gdp_cap MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: religion=col(source(s), name("religion"), unit.category()) DATA: gdp_cap=col(source(s), name("gdp_cap")) GUIDE: axis(dim(1), label("Predominant religion")) GUIDE: axis(dim(2), label("Average GDP per capita")) SCALE: linear(dim(2), include(0)) SCALE: cat(dim(1), sort.data()) ELEMENT: interval(position(religion*gdp_cap), shape.interior(shape.square)) END GPL. Notes: 1. AGGREGATE creates as many cases as values of religion (about 12 in this example). 2. The DATASET DECLARE command provides a handle for the new aggregated dataset. 3. The DATASET ACTIVATE command makes the new aggregated file the active data file for the commands following it. 4. The n of cases command is used to restrict the number of cases to 5. 5. The sort.data function on the GPL SCALE command orders the categories by their appearance in the data file. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jim Sent: Monday, September 21, 2009 11:57 AM To: [hidden email] Subject: Using GPL to sort and also exclude categorical data I would like to show only the top 5 of 10 mean scores on a simple bar chart using GPL. I have been able to get my data to sort using sort.statistic and I have been able to get my data to exclude certain categories. But I can't get my head around how to do both. Thanks for any help. Jim ===================== 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 |
| Free forum by Nabble | Edit this page |
