Population pyramids
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | * (Q) How can I produce a Population pyramid? * (A) Posted to SPSSX-L on 2003/02/22 by Raynald Levesque. NEW FILE. INPUT PROGRAM. LOOP cnt=1 TO 1000. + COMPUTE sex=UNIFORM(1)>.5. + COMPUTE ageb=TRUNC(UNIFORM(10)). + END CASE. END LOOP. END FILE. END INPUT PROGRAM. AGGREGATE OUTFILE=* /BREAK=sex ageb /nb=N. VALUE LABELS sex 0 'Male' 1 'Female' /ageb 0 "0-10" 1 "11-20" 2 "21-30" 3 "31-40" 4 "41-50" 5 "51-60" 6 "61-70" 7 "71-80" 8 "81-90" 9 "91+". FORMATS ageb(F3). VARIABLE LABEL ageb "age bands". IF sex=1 nb=-nb. SET CCA=",,,". FORMAT nb (CCA10). IGRAPH /VIEWNAME='Population Pyramid' /X1 = VAR(ageb) TYPE = CATEGORICAL /Y = VAR(nb) TYPE = SCALE TITLE='population' /COLOR = VAR(sex) TYPE = CATEGORICAL STACK /COORDINATE = HORIZONTAL /X1LENGTH=3.0 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE' /CATORDER VAR(ageb) (ASCENDING VALUES OMITEMPTY) /CATORDER VAR(sex) (ASCENDING VALUES OMITEMPTY) /BAR(SUM) KEY=ON SHAPE = RECTANGLE BASELINE=AUTO. |
Related pages
...
Navigate from here