TEMPLATE Procedure: Creating Tabular Output |
PROC TEMPLATE features: |
| |||||||
Other ODS features: |
| |||||||
Data set: | Exprev. |
Program Description |
This example compares the use of an EDIT statement with a DEFINE TABLE statement for the same table template. The first program uses the EDIT statement to change the Base.Summary table template. The foreground color of the NOBS column is changed to green. The other templates and attributes of the Base.Summary table template remain the same. The second program uses the DEFINE TABLE statement to define a new table using the same name, Base.Summary. The NOBS column is the only column defined in the new table template. When the PROC SUMMARY step executes, only the NOBS column is printed. The only style attribute that formats the column is the color=green attribute.
Program 1 |
HTML Output Using an Edited Table Template for Base.Summary
Base.Summary Table Template Modified by the EDIT Statement
define mode; header = "Mode"; generic; end; define median; header = "Median"; generic; end; define kurt; header = "Kurtosis"; generic; end; define skew; header = "Skewness"; generic; end; define uclm; define header huclm; text "Upper " clmpct BEST8. %nrstr("%%/CL for Mean"); split = "/"; end; header = huclm; generic; end; define lclm; define header hlclm; text "Lower " clmpct BEST8. %nrstr("%%/CL for Mean"); split = "/"; end; header = hlclm; generic; end; define probt; parent = Common.ParameterEstimates.Probt; generic; end; define t; parent = Common.ParameterEstimates.tValue; generic; end; define stderr; header = "Std Error"; parent = Common.ParameterEstimates.StdErr; generic; end; define cv; header = "Coeff of Variation"; generic; end; define stddev; header = "Std Dev"; generic; end; define var; header = "Variance"; generic; end; define css; define header hcss; text2 "CSS"; text "Corrected SS"; end; header = hcss; generic; end; define uss; define header huss; text2 "USS"; text "Uncorrected SS"; end; header = huss; generic; end;
define mean; header = "Mean"; generic; end; define sum; header = "Sum"; generic; end; define sumwgt; header = "Sum Wgts"; generic; end; define nmiss; header = "N Miss"; generic; end; define n; header = "N"; generic; end; define range; header = "Range"; generic; end; define max; define header hmax; text2 "Max"; text "Maximum"; end; header = hmax; generic; end; define min; define header hmin; text2 "Min"; text "Minimum"; end; header = hmin; generic; end; define label; header = "Label"; id; generic; end; define varname; header = "Variable"; id; generic; end; define ways; header = "Ways"; vjust = T; id; end; define type; header = "Type"; vjust = T; id; end; define id; vjust = T; id; generic; end;
define nobs; header = "N Obs"; vjust = T; style = { color = green }; id; end; define class; vjust = T; id; generic; blank_internal_dups; end; define h; text "Analysis Variable : " one_var_name " " one_var_label; space = 1; just = C; print = one_var; spill_margin; end; required_space = 5; underline; overline; byline; use_format_defaults; double_space; split_stack; use_name; order_data; classlevels; end; run;
Program 2 |
ods path work.templat (update) sashelp.tmplmst (read); proc template; define table Base.Summary; notes "Summary table for MEANS and SUMMARY"; dynamic clmpct one_var_name one_var_label one_var; column class nobs id type ways (varname) (label) (min) (max) (range) (n ) (nmiss) (sumwgt) (sum) (mean) (uss) (css) (var) (stddev) (cv) ( stderr) (t) (probt) (lclm) (uclm) (skew) (kurt) (median) (mode) (q1) (q3) (qrange) (p1) (p5) (p10) (p25) (p50) (p75) (p90) (p95) (p99); define nobs; style={color=magenta backgroundcolor=white}; end; end; run; ods html file="temp.html"; proc summary data=exprev print; class Sale_Type; run; ods html close; |
HTML Output That Uses the Table Template Base.Summary.
Base.Summary Table Template Created by the DEFINE TABLE Statement
|
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.