Features: |
crosstabs-attributes statements CELLVALUE statement
END statement FOOTER statement HEADER statement NOTES statement |
Other features: |
|
Proc Format; Value Govtfmt -3='Council Manager' 0='Commission' 3='Mayor Council' .N='Not Applicable' .=' ?'; Value Robfmt 1='100 or Less' 2='101-200' 3='201-300' 4='Over 300' .N='Not Known' .=' ?'; Value Colfg 1='yellow' 2='red' 3='blue' 4='purple' .N='green' .='black' other='black'; Value Rowfg -3='red' 0='purple' 3='blue' .N='green' .='black' other='black'; run; data gov; Label Citygovt='City Government Form' Robgrp='Number of Meetings Scheduled'; Input Citygovt Robgrp Weight; Missing N; Format Citygovt Govtfmt. Robgrp Robfmt.; LOOP: OUTPUT; WEIGHT=WEIGHT-1; IF WEIGHT>0 THEN GOTO LOOP; DROP WEIGHT; datalines; 0 1 6 0 3 3 0 2 7 0 4 5 N N 10 -3 1 47 -3 3 49 -3 2 63 -3 4 52 . 2 1 3 1 31 3 2 37 3 3 27 3 4 55 3 . 1 ;
ods path (prepend) work.templat(update); ods noproctitle; proc template; define style white; parent=styles.htmlblue; style body / backgroundcolor=white; style systemtitle / backgroundcolor=white fontsize=6 fontweight=bold fontstyle=italic; style systemfooter / backgroundcolor=white fontsize=2 fontstyle=italic; style proctitle / backgroundcolor=white color=#6078bf fontweight=bold fontstyle=italic; end;
define crosstabs Base.Freq.CrossTabFreqs; notes "Crosstabulation table";
style=table {backgroundcolor=#BFCFFF}; cell_style=data {backgroundcolor=#FFFFF0}; row_var_style=rowheader {backgroundcolor=#BFCFFF color=rowfg.}; col_var_style=header {backgroundcolor=#BFCFFF color=colfg.}; row_total_style=data {backgroundcolor=#F0F0F0}; col_total_style=data {backgroundcolor=#F0F0F0}; grand_total_style=datastrong {backgroundcolor=#F0F0F0}; legend_style=header {backgroundcolor=#BFCFFF color=#6078bf fontstyle=italic};
rows_header=RowsHeader cols_header=ColsHeader; label = "Frequency Counts and Percentages";
define header TableOf; text "Table of " _ROW_LABEL_ " by " _COL_LABEL_ / _ROW_LABEL_ ^= '' & _COL_LABEL_ ^= ''; text "Table of " _ROW_LABEL_ " by " _COL_NAME_ / _ROW_LABEL_ ^= ''; text "Table of " _ROW_NAME_ " by " _COL_LABEL_ / _COL_LABEL_ ^= ''; text "Table of " _ROW_NAME_ " by " _COL_NAME_; style=header {backgroundcolor=#BFCFFF color=#6078bf fontstyle=italic}; end;
define header RowsHeader; text _ROW_LABEL_ / _ROW_LABEL_ ^= ''; text _ROW_NAME_; style=header {backgroundcolor=#BFCFFF color=#6078bf fontstyle=italic}; space=0; end;
define header ColsHeader; text _COL_LABEL_ / _COL_LABEL_ ^= ''; text _COL_NAME_; style=header {backgroundcolor=#BFCFFF color=#6078bf fontstyle=italic}; space=1; end;
define header ControllingFor; dynamic StratNum StrataVariableNames StrataVariableLabels; text "Controlling for" StrataVariableNames / StratNum > 0; style=header; end;
define footer Missing; dynamic FMissing; text "Frequency Missing = " FMissing -12.99 / FMissing ^= 0; style=header {backgroundcolor=#BFCFFF color=#6078bf fontstyle=italic}; space=1; end; define footer NoObs; dynamic SampleSize; text "Effective Sample Size = 0" / SampleSize = 0; space=1; style=header; end;
define cellvalue Frequency; header=""; label="Frequency Count"; format=BEST7.; data_format_override=on; print=on; cellstyle _val_ < 10 as datastrong {color=green}, _val_ > 40 & _val_ < 50 as datastrong {color=orange}, _val_ >= 50 as datastrong {color=red}; end; define cellvalue Expected; header=""; label="Expected Frequency"; format=BEST6. data_format_override=on print=on; end; define cellvalue Deviation; header=""; label="Deviation from Expected Frequency"; format=BEST6. data_format_override=on print=on; end; define cellvalue CellChiSquare; header=""; label="Cell Chi-Square"; format=BEST6. print=on; end; define cellvalue TotalPercent; header=""; label="Percent of Total Frequency"; format=6.2 print=on; end; define cellvalue Percent; header=""; label="Percent of Two-Way Table Frequency"; format=6.2 print=on; end; define cellvalue RowPercent; header=""; label="Percent of Row Frequency"; format=6.2 print=on; end; define cellvalue ColPercent; header=""; label="Percent of Column Frequency"; format=6.2 print=on; end; define cellvalue CumColPercent; header=""; label="Cumulative Percent of Column Frequency"; format=6.2 print=on; end;
cellvalue Frequency Expected Deviation CellChiSquare TotalPercent Percent RowPercent ColPercent CumColPercent;
header TableOf ControllingFor; footer NoObs Missing; end;
ods html file='MyCrosstabsTable.html' style=white;
title "City Government Form by Number of Meetings Scheduled"; footnote "Cellvalues are stacked in the following order:"; footnote2 "Frequency"; footnote3 "Percent"; footnote4 "Row Percent"; footnote5 "Column Percent"; ods noproctitle;
proc freq; tables citygovt*robgrp / missprint; run;
ods html close;
Proc Format; Value Govtfmt -3='Council Manager' 0='Commission' 3='Mayor Council' .N='Not Applicable' .=' ?'; Value Robfmt 1='100 or Less' 2='101-200' 3='201-300' 4='Over 300' .N='Not Known' .=' ?'; Value Colfg 1='yellow' 2='red' 3='blue' 4='purple' .N='green' .='black' other='black'; Value Rowfg -3='red' 0='purple' 3='blue' .N='green' .='black' other='black'; run; data gov; Label Citygovt='City Government Form' Robgrp='Number of Meetings Scheduled'; Input Citygovt Robgrp Weight; Missing N; Format Citygovt Govtfmt. Robgrp Robfmt.; LOOP: OUTPUT; WEIGHT=WEIGHT-1; IF WEIGHT>0 THEN GOTO LOOP; DROP WEIGHT; datalines; 0 1 6 0 3 3 0 2 7 0 4 5 N N 10 -3 1 47 -3 3 49 -3 2 63 -3 4 52 . 2 1 3 1 31 3 2 37 3 3 27 3 4 55 3 . 1 ;
ods path (prepend) work.templat(update); ods noproctitle; proc template; define style white; parent=styles.htmlblue; style body / backgroundcolor=white; style systemtitle / backgroundcolor=white fontsize=6 fontweight=bold fontstyle=italic; style systemfooter / backgroundcolor=white fontsize=2 fontstyle=italic; style proctitle / backgroundcolor=white color=#6078bf fontweight=bold fontstyle=italic; end;
style=table {backgroundcolor=#BFCFFF}; cell_style=data {backgroundcolor=#FFFFF0}; row_var_style=rowheader {backgroundcolor=#BFCFFF color=rowfg.}; col_var_style=header {backgroundcolor=#BFCFFF color=colfg.}; row_total_style=data {backgroundcolor=#F0F0F0}; col_total_style=data {backgroundcolor=#F0F0F0}; grand_total_style=datastrong {backgroundcolor=#F0F0F0}; legend_style=header {backgroundcolor=#BFCFFF color=#6078bf fontstyle=italic};
define header TableOf; text "Table of " _ROW_LABEL_ " by " _COL_LABEL_ / _ROW_LABEL_ ^= '' & _COL_LABEL_ ^= ''; text "Table of " _ROW_LABEL_ " by " _COL_NAME_ / _ROW_LABEL_ ^= ''; text "Table of " _ROW_NAME_ " by " _COL_LABEL_ / _COL_LABEL_ ^= ''; text "Table of " _ROW_NAME_ " by " _COL_NAME_; style=header {backgroundcolor=#BFCFFF color=#6078bf fontstyle=italic}; end;
define header RowsHeader; text _ROW_LABEL_ / _ROW_LABEL_ ^= ''; text _ROW_NAME_; style=header {backgroundcolor=#BFCFFF color=#6078bf fontstyle=italic}; space=0; end;
define header ColsHeader; text _COL_LABEL_ / _COL_LABEL_ ^= ''; text _COL_NAME_; style=header {backgroundcolor=#BFCFFF color=#6078bf fontstyle=italic}; space=1; end;
define header ControllingFor; dynamic StratNum StrataVariableNames StrataVariableLabels; text "Controlling for" StrataVariableNames / StratNum > 0; style=header; end;
define footer Missing; dynamic FMissing; text "Frequency Missing = " FMissing -12.99 / FMissing ^= 0; style=header {backgroundcolor=#BFCFFF color=#6078bf fontstyle=italic}; space=1; end; define footer NoObs; dynamic SampleSize; text "Effective Sample Size = 0" / SampleSize = 0; space=1; style=header; end;
define cellvalue Frequency; header=""; label="Frequency Count"; format=BEST7.; data_format_override=on; print=on; cellstyle _val_ < 10 as datastrong {color=green}, _val_ > 40 & _val_ < 50 as datastrong {color=orange}, _val_ >= 50 as datastrong {color=red}; end; define cellvalue Expected; header=""; label="Expected Frequency"; format=BEST6. data_format_override=on print=on; end; define cellvalue Deviation; header=""; label="Deviation from Expected Frequency"; format=BEST6. data_format_override=on print=on; end; define cellvalue CellChiSquare; header=""; label="Cell Chi-Square"; format=BEST6. print=on; end; define cellvalue TotalPercent; header=""; label="Percent of Total Frequency"; format=6.2 print=on; end; define cellvalue Percent; header=""; label="Percent of Two-Way Table Frequency"; format=6.2 print=on; end; define cellvalue RowPercent; header=""; label="Percent of Row Frequency"; format=6.2 print=on; end; define cellvalue ColPercent; header=""; label="Percent of Column Frequency"; format=6.2 print=on; end; define cellvalue CumColPercent; header=""; label="Cumulative Percent of Column Frequency"; format=6.2 print=on; end;
cellvalue Frequency Expected Deviation CellChiSquare TotalPercent Percent RowPercent ColPercent CumColPercent;
title "City Government Form by Number of Meetings Scheduled"; footnote "Cellvalues are stacked in the following order:"; footnote2 "Frequency"; footnote3 "Percent"; footnote4 "Row Percent"; footnote5 "Column Percent"; ods noproctitle;