Digital Developer Conference: a FREE half-day online conference focused on AI & Cloud – North America: Nov 2 – India: Nov 9 – Europe: Nov 14 – Asia Nov 23 Register now

Close outline
  • United States
IBM?
  • Site map
IBM?
  • Marketplace

  • Close
    Search
  • Sign in
    • Sign in
    • Register
  • IBM Navigation
IBM Developer Answers
  • Spaces
    • Blockchain
    • IBM Cloud platform
    • Internet of Things
    • Predictive Analytics
    • Watson
    • See all spaces
  • Tags
  • Users
  • Badges
  • FAQ
  • Help
Close

Name

Community

  • Learn
  • Develop
  • Connect

Discover IBM

  • ConnectMarketplace
  • Products
  • Services
  • Industries
  • Careers
  • Partners
  • Support
10.190.13.195

Predictive Analytics×

Refine your search by using the following advanced search options.

Criteria Usage
Questions with keyword1 or keyword2 keyword1 keyword2
Questions with a mandatory word, e.g. keyword2 keyword1 +keyword2
Questions excluding a word, e.g. keyword2 keyword1 -keyword2
Questions with keyword(s) and a specific tag keyword1 [tag1]
Questions with keyword(s) and either of two or more specific tags keyword1 [tag1] [tag2]
To search for all posts by a user or all posts with a specific tag, start typing and choose from the suggestion list. Do not use a plus or minus sign with a tag, e.g., +[tag1].
  • Ask a question

Customize data labels through syntax?

270006RETC gravatar image
Question by Londoner  (0) | May 20, 2014 at 05:31 PM spssstatisticssyntax

Hi all,

I'm new to the forum and still relatively new to SPSS as well. At the moment I am starting to get to grips with syntax in an effort to customize some charts beyond the standard options.

I managed to change the syntax to get a bar chart that is both clustered and stacked. Quick description of the data setup (slightly altered for confidentiality): x Axis shows four regions (North, South, West, East). In each region, there are three bars (Bachelor, Master, PhD), that describe 100% of students in that region. Each of these bars is stacked by gender (male female).

What I want the data labels to do is the following:

1. For each bar, show the % within that region at the top (the three bars must sum to 100%), so for example:

North --> 70% Bachelor, 12% Master, 18% PhD (showing at the top of each bar - not actual data, I am simulating at the moment)

2. Then within each bar, I want the % breakdown by gender, e.g. for North, Bachelor:

53% Female, 47% Male.

Reason: I want to be able to compare the gender breakdown within each education tier across regions, while also comparing the tier breakdown itself across regions at the same time. So for example, even though the amount of female Master students and female PhD students as a percentage of all North students is the same, the labels do make clear that the rate of females as a percentage of all PhD students in North is lower than as a rate of all Master students in North. (Hope this makes sense)

See attached for a visual example - I edited the chart in MS Word and have just added label for North to save time, I hope it makes clear what I am talking about.

Now finally the question: Is it possible to achieve this type of labeling, either through the menu or through syntax?

I have so far used the following code to generate the chart. Problem is, this is giving me the percentage for each "part of each bar" as a percentage of all students in a region, so the bar for North & Bachelor shows 37% in the female section and 33% in the male section

* Chart Builder.

GGRAPH

/GRAPHDATASET NAME="graphdataset" VARIABLES=region COUNT()[name="COUNT"] educ gender MISSING=LISTWISE

REPORTMISSING=NO

/GRAPHSPEC SOURCE=INLINE.

BEGIN GPL

SOURCE: s = userSource(id("graphdataset"))

DATA: Office = col(source(s), name("region"), unit.category())

DATA: Tier = col(source(s), name("educ"), unit.category())

DATA: Bid = col(source(s), name("gender"), unit.category())

DATA: COUNT = col(source(s), name("COUNT"))

COORD: rect(dim(1, 2), cluster(3, 0))

SCALE: linear(dim(2), include(0))

GUIDE: axis(dim(2), label("Percent"))

GUIDE: axis(dim(3), label("region"))

GUIDE: legend(aesthetic(aesthetic.color.interior), label("educ"))

GUIDE: legend(aesthetic(aesthetic.texture.pattern.interior),

label("gender"))

ELEMENT: interval.stack(position(summary.percent(educ*COUNT*region, base.coordinate(dim(3)))),

color.exterior(color.black),

color.interior(educ), texture.pattern.interior(gender))

END GPL.

Any help on how I may alter this code to get the desired labeling would be very much appreciated. Thanks to all for reading!

People who like this

  0
Comment
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster

0 answers

  • Sort: 

Follow this question

45 people are following this question.

Answers

Answers & comments

Related questions

Unrecoverable application error in the Statistics processor. 7 Answers

SPSS 20 - How do I automate exporting of specific tables to excel? 3 Answers

missing data 2 Answers

Case by Case Comparison Calcualtions using Syntax 4 Answers

GET DATA strange behaviour 3 Answers

  • Contact
  • Privacy
  • IBM Developer Terms of use
  • Accessibility
  • Report Abuse
  • Cookie Preferences

Powered by AnswerHub

Authentication check. Please ignore.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • API Connect
  • Analytic Hybrid Cloud Core
  • Application Performance Management
  • Appsecdev
  • BPM
  • Blockchain
  • Business Transaction Intelligence
  • CAPI
  • CAPI SNAP
  • CICS
  • Cloud Analytics
  • Cloud Automation
  • Cloud Object Storage
  • Cloud marketplace
  • Collaboration
  • Content Services (ECM)
  • Continuous Testing
  • Courses
  • Customer Experience Analytics
  • DB2 LUW
  • Data and AI
  • DataPower
  • Decision Optimization
  • DevOps Build
  • DevOps Services
  • Developers IBM MX
  • Digital Commerce
  • Digital Experience
  • Finance
  • Global Entrepreneur Program
  • Hadoop
  • Hybrid Cloud Core
  • Hyper Protect
  • IBM Cloud platform
  • IBM Design
  • IBM Forms Experience Builder
  • IBM Maximo Developer
  • IBM StoredIQ
  • IBM StoredIQ-Cartridges
  • IIDR
  • ITOA
  • InformationServer
  • Integration Bus
  • Internet of Things
  • Kenexa
  • Linux on Power
  • LinuxONE
  • MDM
  • Mainframe
  • Messaging
  • Node.js
  • ODM
  • Open
  • PartnerWorld Developer Support
  • PowerAI
  • PowerVC
  • Predictive Analytics
  • Product Insights
  • PureData for Analytics
  • Push
  • QRadar App Development
  • Run Book Automation
  • Search Insights
  • Security Core
  • Storage
  • Storage Core
  • Streamsdev
  • Supply Chain Business Network
  • Supply Chain Insights
  • Swift
  • UBX Capture
  • Universal Behavior Exchange
  • UrbanCode
  • WASdev
  • WSRR
  • Watson
  • Watson Campaign Automation
  • Watson Content Hub
  • Watson Marketing Insights
  • dW Answers Help
  • dW Premium
  • developerWorks Sandbox
  • developerWorks Team
  • Watson Health
  • More
  • Tags
  • Questions
  • Users
  • Badges