Thursday, August 20, 2009

Short for style expression

With the power of ODS, we can specify the style elements for specific location, especially for reporting procedure like PROC PRINT, PROC REPORT, PROC TABULATE.
If the style expression is trivial and long, it will be boring to apply same style expression to many reports at one time.

For example:

ods html file="style.html";
proc report data=sashelp.class nowd;
column name age;
define name/display
style(header)=[just=l
foreground=red
cellwidth=2cm]
;
define age / display ;
run;
ods html close;


To avoid typing the same expression again and again, we can customize style using PROC TEMPLATE.

The report above can be converted to:

proc template;
define style styles.mystyle;
parent=default;
style header1 from header /
foreground=red
width=2cm
textalign=left;
end;
run;

ods html file="style2.html" style=mystyle;
proc report data=sashelp.class nowd;
column name age;
define name / style(header) = header1;
define age / display ;
run;

ods html close;

Tuesday, August 18, 2009

Are you missing "missing option"?

Generally, SAS do not take missing value as a valid value, especially for class variable. That means there will be an implicit filter to delete all "missing" class, e.g. the class variable in Proc MEANS, PROC FREQ.

Likewise, missing values is not valid value for any group, order or across variable in Proc REPORT.

Tuesday, August 11, 2009

What ODS templates are in use?

Generally, procedure output will use table template and style template.

Below are the methods to identify them:
#1:
ODS TRACE statement can print what table template is in use.

#2:
Default style information is in SAS registry.

command "regedit" -> ODS -> DESTINATION -> "Selected Style" entry in specified destination