0byt3m1n1
Path:
C:
/
Users
/
Administrator
/
SYSTAT
/
SYSTAT_13
/
Gallery
/
[
Home
]
File: Count as Percent of All Cases.syc
REM This item was created using USSTATES, with REGION$ as the, categorical variable. TOKEN TOKEN &message / TYPE = MESSAGE PROMPT = 'This item graphs the count at, each level of a categorical variable as the percent of all cases. , Two temporary files containing statistics necessary to create the, graph are created and subsequently deleted. Upon completion, no, data file is open.' TOKEN &catvar / TYPE = VARIABLE PROMPT = 'Choose a categorical variable, for the X-axis.' IMMEDIATE TOKEN &outfxtab / TYPE = SAVE PROMPT = 'Specify a file for saving the, one-way frequency table.' TOKEN &outfstats / TYPE = SAVE PROMPT = 'Specify a file for saving, Descriptive Statistics results.' OUTPUT / NOSCREEN LET flag = 1 SWORK &outfstats / AG STATISTICS flag / N XTAB WORK &outfxtab TABULATE &catvar MERGE &outfxtab &outfstats IF CASE() <> 1 THEN LET nu1flag = LAG(nu1flag) LET percent = 100 * (COUNT/nu1flag) OUTPUT REM To adapt this file to plot other categorical graphs such as DOT, LINE, PROFILE, PYRAMID, or PIE graphs, change the command BAR below, to that of the graph type you want. BAR percent * &catvar / LABEL YLABEL = 'Count as Percent of All Cases', CSIZE = 0.67 TOKEN