0byt3m1n1
Path:
C:
/
Users
/
Administrator
/
SYSTAT
/
SYSTAT_13
/
Gallery
/
[
Home
]
File: Count as Percent of Valid 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, valid cases. A temporary file containing statistics, necessary to create the graph is 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.' OUTPUT / NOSCREEN XTAB WORK &outfxtab TAB &catvar USE &outfxtab IF BOF() THEN LET n = COUNT, ELSE LET n = LAG(n) + COUNT SORT &catvar / D IF NOT BOF() THEN LET n = LAG(n) LET percent = 100 * (COUNT/n) 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 Valid Cases', CSIZE = 0.67 TOKEN