OUT PUT DELIVERY SYSTEM (ODS) :

ODS is useful to convert analysis or reporting information into different client required reporting formats like HTML, PDF, RTF, EXCEL, CSV, PS, XML,CSS, MARKUP etc…
And useful to deliver that analysis info or reports to business users.

SAS OUTPUT DESTINATIONS

If we don’t specify a destination, your output will be sent, by default, to the listing.
The LISTING destination is what you see in the Output window.

screenshot 2025 09 13 163004

HTML (HYPER TEXT MARKUP LANGUAGE)

DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS HTML
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.html”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;

HTML OPTIONS
STYLE = style-name: Specifies a style template. The default style is DEFAULT.

ODS HTML
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.html”
STYLE=SEASIDE;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;

List of styles:
Analysis, Astronomy, Banker, BarrettsBlue, Beige, Brick, Brown, Curve, D3d, Default, EG Default, Education, Electronics, Festival, Festivals Printer, Gears, Harvest, High Contrast, Journal, Journal2, Journal 3,Listing, Magnify, Meadow, Meadow Printer, Minimal, Money, No Font Default, Normal, Normal Printer, Ocean, Printer, Rsvp, Rtf, Sasweb, Science, Seaside, Seaside Printer, Sketch, Solutions, Statdoc, Statistical, Theme, Torn, Watercolor, block Print, fancy Printer, grayscale Printer, monochrome Printer,
SansPrinter, sas dosPrinter, serif Printer etc…

CONTENTS = ‘filename’ : Creates a table of contents with links to the body file.
FILENAME KRISH “C:\Documents and Settings\Administrator\Desktop\sas\test1.html”;
ODS HTML
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.html”
CONTENTS=KRISH;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;

PAGE = ‘filename’: Creates a table of contents with links by page number.
FILENAME KRISH “C:\Documents and Settings\Administrator\Desktop\sas\test2.html”;
ODS HTML
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.html”
PAGE=KRISH;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;

FRAME = ‘filename’ : Creates a frame that allows you to view the body file and the contents or the page file at the same time. If you do not want either the contents or the page file, then you don’t need to create a frame file.
FILENAME KRISH “C:\Documents and Settings\Administrator\Desktop\sas\test3.html”;
ODS HTML
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.html”
FRAME=KRISH;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;

PDF (PORTABLE DOCUMENT FORMAT)

DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS PDF “C:\Documents and Settings\Administrator\Desktop\sas\Demo.PDF”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX; PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS PDF CLOSE;

PDF OPTIONS
STYLE = style-name: Specifies a style.
ODS PDF
FILE=”C:\Documents and Settings\Administrator\Desktop\New Folder\Demo.PDF” Style=seaside;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
PROC GCHART DATA=DS;
VBAR3D SEX;
RUN;
PROC MEANS DATA=DS;
CLASS SEX;
RUN;
ODS PDF CLOSE;

STARTPAGE = value: It controls page breaks. The default value is
YES, inserts a break between procedures OUTPUT.
NO, turns off breaks. Except SAS graph procedures
Never, Tells SAS “Don’t go to a new page except when you run out of room, even for SAS/GRAPHS also.
NOW, inserts a break at that point.

ODS PDF
FILE=”C:\Documents and Settings\Administrator\Desktop\New Folder\Demo.PDF” STARTPAGE=NEVER;
PROC PRINT DATA=DS(OBS=6) NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX; PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=5 ‘ Student Data’;
Title2 c=red f=Arial h=5 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=5 ‘Generated by Mr. Krishna ‘;
RUN;
PROC MEANS DATA=DS;
CLASS SEX;
RUN;
PROC GCHART DATA=DS;
VBAR3D SEX;
RUN;
ODS PDF CLOSE;

NOTOC: Suppresses table of contents.
Otherwise it prints bookmarks or table of contents.
The default behavior for a PDF is to make a table of contents. For the PDF destination the table of contents is rendered as a set of bookmarks, which link to the corresponding section in the document. This can be a very handy feature when you are producing output that can be tens or even hundreds of pages long.

ODS PDF
FILE=”C:\Documents and Settings\Administrator\Desktop\New Folder\Demo.PDF” NOTOC;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=5 ‘ Student Data’;
Title2 c=red f=Arial h=5 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=5 ‘Generated by Mr. Krishna ‘;
RUN;
PROC MEANS DATA=DS;
RUN;
ODS PDF CLOSE;

Assigns Password to pdf
Options pdfsecurity=low pdfpassword=(open=”STANSYS” owner=”KRISHNA”);
ODS PDF
FILE=”C:\Documents and Settings\Administrator\Desktop\SAS\Demo.PDF” ;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=5 ‘ Student Data’;
Title2 c=red f=Arial h=5 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=5 ‘Generated by Mr. Krishna ‘;
RUN;
ODS PDF CLOSE;

RTF (RICH TEXT FORMAT)

DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS RTF
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.RTF”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS RTF CLOSE;

RTF OPTIONS
COLUMNS=NO: Prints multiple outputs as no of columns.
ODS RTF
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.RTF”
COLUMNS=2;
PROC MEANS DATA=DS;
RUN;
PROC PRINT DATA=DS;
RUN;
ODS RTF CLOSE;

SASDATE: Default SAS prints date and time on top of RTF output. When this option is on whenever you open RTF output it change date and time according to system time.
ODS RTF
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.RTF” SASDATE;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS RTF CLOSE;

BODYTITLE: Puts titles and footnotes in the main part of the RTF document
instead of in Word headers or footers.
ODS RTF
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.RTF” BODYTITLE;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX; PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS RTF CLOSE;

STYLE = style: Name specifies a style template. The default style is named RTF.
ODS RTF
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.RTF” STYLE=MONEY;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS RTF CLOSE;

STARTPAGE = value: It controls page breaks. The default value is
YES, inserts a break between procedures.
NO, turns off breaks.
NOW, inserts a break at that point.
ODS RTF
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.RTF” STARTPAGE=NO ;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
PROC MEANS DATA=DS;
CLASS SEX;
RUN;
ODS RTF CLOSE;

CSV (COMMA SEPARATED VALUE)

DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS CSV
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.CSV”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS CSV CLOSE;

XML (EXTENSIBLE MARKUP LANGUAGE)

DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS XML
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.XML”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT ;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS XML CLOSE;

CSS (CASCADING STYLE SHEETS)

DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS CSS
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.CSS”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS CSS CLOSE;

PRINTER

DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS PRINTER
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.html”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS PRINTER CLOSE;
NOTE: Sending ODS PRINTER output to printer “\\server\Canon E510 series Printer”.
NOTE: ODS PRINTER printed 2 pages to C:\Documents and
Settings\Administrator\Desktop\sas\Demo.html.

PCL (PRINTER CONTROL LANGUAGE)

DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS PCL
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.PCL”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red bcolor=y f=Arial h=7 ‘ Student Data’;
Title2 c=red bcolor=c f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS PCL CLOSE;
NOTE: Writing ODS PCL output to DISK destination
“C:\Documents and Settings\Administrator\Desktop\sas\Demo.PCL”, printer “PCL5”.
NOTE: ODS PCL printed 2 pages to C:\Documents and Settings\Administrator\Desktop\sas\Demo.PCL

PS (POST SCRIPT)

DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS PS
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.PS”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS PS CLOSE;

MARKUP

DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS MARKUP
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.MARKUP”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX; PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS MARKUP CLOSE;

EXCEL

DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS TAGSETS.EXCELXP
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.XLS”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX; PAGEBY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS TAGSETS.EXCELXP CLOSE;

ODS < = (ODS-suboptions) > with File statement
Specifies to use the Output Delivery System to format the output from a DATA step. It defines the structure of the data component and holds the results of the DATA step and binds that component to a table definition to produce an output object. ODS sends this object to all open ODS destinations like html, pdf, rtf etc…

DATA _NULL_;
INFILE DATALINES;
INPUT ID NAME$ SEX$ AGE SAL;
FILE PRINT ODS;
PUT ID NAME SEX AGE SAL;
DATALINES;
001 ABC M 20 2500
002 DEF M 22 3000
003 XYZ F 21 5000
;
RUN;

Creating a Report with the DATA Step and the Default Table Definition
DATA _NULL_;
INFILE DATALINES;
INPUT ID NAME$ SEX$ AGE SAL;
FILE PRINT ODS;
PUT _ODS_;
DATALINES;
001 ABC M 20 2500
002 DEF M 22 3000
003 XYZ F 21 5000
;
RUN;

Producing ODS Output That Contains Selected Variables
DATA _NULL_;
INFILE DATALINES;
INPUT ID NAME$ SEX$ AGE SAL;
FILE PRINT ODS=(VARIABLES=(NAME SAL));
PUT _ODS_;
DATALINES;
001 ABC M 20 2500
002 DEF M 22 3000
003 XYZ F 21 5000
;
RUN;

Producing ODS Output That Contains Selected Variables into HTML format
ODS HTML FILE=
“C:\Documents and Settings\Administrator\Desktop\STANSYS\SAMPLE.HTML”;
DATA _NULL_;
INFILE DATALINES;
INPUT ID NAME$ SEX$ AGE SAL;
FILE PRINT ODS=(VARIABLES=(NAME AGE SAL));
PUT _ODS_;
DATALINES;
001 ABC M 20 2500
002 DEF M 22 3000
003 XYZ F 21 5000
;
RUN;

Assigning Attributes to Columns and Object label in ODS Output
ODS PDF FILE=
“C:\Documents and Settings\Administrator\Desktop\STANSYS\SAMPLE.PDF”;
PROC FORMAT;
VALUE $GEN ‘F’=’FEMALE’
‘M’=’MALE’;
RUN;
DATA _NULL_;
INFILE DATALINES;
INPUT ID NAME$ SEX$ AGE SAL;
FORMAT SEX $GEN.;
LABEL SEX=GENDER;
IF SEX=’M’;
FILE PRINT ODS=(OBJECTLABEL=’MALE DATA’);
PUT _ODS_;
DATALINES;
001 ABC M 20 2500
002 DEF M 22 3000
003 XYZ F 21 5000
;
RUN;
ODS PDF CLOSE;

GENERAL ODS OPTIONS

ODS NOPROCTITLE
Some procedures like Proc Means, Proc Freq etc… prints procedure name in output If you want suppress that proc name use ODS NOPROCTITLE.
ODS NOPROCTITLE;
ODS RTF
FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.RTF” ;
PROC MEANS DATA=DS;
RUN;
ODS RTF CLOSE;

ODS TEXT
Inserts text in output.
DATA DS;
SET SASHELP.CLASS;
RUN;
ODS PDF
FILE=”C:\Documents and Settings\Administrator\Desktop\New Folder\Demo.PDF” STARTPAGE=NEVER;
ODS TEXT=”This procedure is giving subtotals for height and weight based on both female and male groups”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=5 ‘ Student Data’;
Title2 c=red f=Arial h=5 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=5 ‘Generated by Mr. Krishna ‘;
RUN;
PROC MEANS DATA=DS;
RUN;
ODS PDF TEXT=” We can write text here also”;
ODS PDF CLOSE;

ODS PROCLABEL
PROCLABEL=”Text”, before the procedure
Whose bookmark you want to modify. Specify the modify information instead of text.
DATA DS;
SET SASHELP.CLASS;
RUN;
ODS PDF
FILE=”C:\Documents and Settings\Administrator\Desktop\New Folder\Demo.PDF”;
ODS PROCLABEL=”Total height & Weight for SASHELP.CLASS Data”;
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=5 ‘ Student Data’;
Title2 c=red f=Arial h=5 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=5 ‘Generated by Mr. Krishna ‘;
RUN;
ODS PROCLABEL=”Calculating simple statistics for SASHELP.CLASS Data”;
PROC MEANS DATA=DS;
RUN;
ODS PDF CLOSE;

The ODS TRACE statement

The ODS TRACE statement tells SAS to print information about output objects in your SAS log. There are two ODS TRACE statements: those are ODS TRACE ON, and ODS TRACE OFF.
Syntax:-
ODS TRACE ON;
PROC STEP;
ODS TRACE OFF;
Example:-
DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS TRACE ON;
PROC MEANS DATA=DS;
BY SEX;
RUN;
ODS TRACE OFF;

See the following trace in your SAS log after executing above program. Because it contains a BY statement, the MEANS procedure produces one output object for each BY group (Sex=F and Sex=M). Notice that these two output objects have the same name, label, and template, but different paths.

Output Added:
Name: Summary
Label: Summary statistics
Template: base.summary
Path: Means.ByGroup1.Summary

NOTE: The above message was for the following by-group: Sex=F

Output Added:
Name: Summary
Label: Summary statistics
Template: base.summary
Path: Means.ByGroup2.Summary

The ODS SELECT/EXCLUDE statements

Once you know the names of the output objects, you can use an ODS SELECT or EXCLUDE statements to choose the output objects which you want.
Syntax:-
The PROC step with the output objects you want to select
ODS SELECT output-object-list;
RUN;
Example:-
DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS TRACE ON;
PROC MEANS DATA=DS;
BY SEX;
ODS SELECT Means.ByGroup2.Summary; /*ODS EXCLUDE Means.ByGroup2.Summary;*/
RUN;
ODS TRACE OFF;

The ODS OUTPUT statement

Sometimes you may want to put the results from a procedure into a SAS data set. Once the results are in a data set, you can merge them with another data set, create new variables based on the results, or use the results as input for other procedures. Some procedures have OUTPUT statements, or OUT= options, allowing you to save the results as a SAS data set. But with ODS you can save almost any part of procedure output as a SAS data set by sending it to the OUTPUT destination. First you use an ODS TRACE statement (discussed in the previous section) to determine the name of the output object you want. Then you use an ODS OUTPUT statement to send that object to the OUTPUT destination.
Syntax:-
ODS SELECT output-object-list;
Here output-object is the name, label or path of the piece of output you want to save, and new-dataset is the name of the SAS data set you want to create.
Example:-
ODS TRACE ON;
DATA DS;
SET SASHELP.CLASS;
RUN;
PROC TABULATE DATA=DS;
CLASS SEX;
VAR HEIGHT WEIGHT;
TABLE SEX*HEIGHT SUM*HEIGHT SEX*WEIGHT SUM*WEIGHT;
ODS OUTPUT TABLE=KRISHNA;
RUN;
ODS TRACE OFF;

Customizing PROC PRINT Output with the STYLE= Option
We can use different styles to change overall look of any output which produce thru proc print, proc report & proc tabulate by using STYLE=OPTION in proc step.
Syntax: – PROC PRINT STYLE (location-list) = {style-attribute = value};
Location – List like
DATA (all the data cells)
HEADER ( the column headers (variable names))
OBS (the data in the OBS column, or ID column if using an ID statement)
OBSHEADER (the header for the OBS or ID column)
TOTAL (the data in the totals row produced by a SUM statement)
GRANDTOTAL (the data for the grand total produced by a SUM statement)

Example:-
DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS HTML FILE=”C:\Documents and Settings\Administrator\Desktop\sas\DEMO.HTM”;
PROC PRINT STYLE(DATA) = {BACKGROUND = pink};
/*PROC PRINT STYLE(HEADER) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(OBS) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(OBSHEADER) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(TOTAL) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(GRANDTOTAL) = {BACKGROUND = pink};*/
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;

Example:-
In above example style is applying for entire table(for all variables one style)
But if you want to apply different styles for different variables see below program.
Syntax:-VAR variable-list / STYLE(location-list) = {style-attribute = value};
ODS HTML FILE=”C:\Documents and Settings\Administrator\Desktop\sas\DEMO.HTM”;
/*PROC PRINT STYLE(DATA) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(HEADER) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(OBS) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(OBSHEADER) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(TOTAL) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(GRANDTOTAL) = {BACKGROUND = pink};*/
PROC PRINT DATA=DS NOOBS;
VAR NAME/STYLE(DATA)={BACKGROUND=RED FOREGROUND=YELLOW} ;
VAR SEX ;
VAR AGE ;
VAR HEIGHT ;
VAR WEIGHT;
BY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;

Example:-
ODS HTML FILE=”C:\Documents and Settings\Administrator\Desktop\mysas\DEMO.HTM”;
/*PROC PRINT STYLE(DATA) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(HEADER) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(OBS) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(OBSHEADER) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(TOTAL) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(GRANDTOTAL) = {BACKGROUND = pink};*/
PROC PRINT DATA=DS NOOBS;
VAR NAME/STYLE(DATA)={BACKGROUND=yellow FOREGROUND=red} ;
VAR SEX /STYLE(HEADER)={BACKGROUND=cyan} ;
VAR AGE /STYLE(DATA)={BACKGROUND=orange FOREGROUND=blue} ;
VAR HEIGHT /STYLE(DATA)={BACKGROUND=gwh } ;
VAR WEIGHT/STYLE(HEADER)={BACKGROUND=magenta} ;
BY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;