- SAS - Dates & Times
- SAS - Macros
- SAS - Input Methods
- SAS - Functions
- SAS - Decision Making
- SAS - Loops
- SAS - Operators
- SAS - Numeric Formats
- SAS - Arrays
- SAS - Strings
- SAS - Variables
- SAS - Data Sets
- SAS - Basic Syntax
- SAS - Program Structure
- SAS - User Interface
- SAS - Environment
- SAS - Overview
- SAS - Home
SAS Data Set Operations
- SAS - Simulations
- SAS - Output Delivery System
- SAS - SQL
- SAS - Format Data Sets
- SAS - Sort Data Sets
- SAS - Subsetting Data Sets
- SAS - Merging Data Sets
- SAS - Concatenate Data Sets
- SAS - Write Data Sets
- SAS - Read Raw Data
SAS Data Representation
SAS Basic Statistical Procedure
- SAS - Hypothesis Testing
- SAS - One-Way Anova
- SAS - Repeated Measure Analysis
- SAS - Fishers Exact Tests
- SAS - Chi-Square
- SAS - Bland-Altman Analysis
- SAS - Linear Regression
- SAS - Correlation Analysis
- SAS - T Tests
- SAS - Cross Tabulations
- SAS - Frequency Distributions
- SAS - Standard Deviation
- SAS - Arithmetic Mean
SAS Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
SAS - ODS
The output from a SAS program can be converted to more user friendly forms pke .html or PDF. This is done by using the ODS statement available in SAS. ODS stands for output depvery system. It is mostly used to format the output data of a SAS program to nice reports which are good to look at and understand. That also helps sharing the output with other platforms and soft wares. It can also combine the results from multiple PROC statements in one single file.
Syntax
The basic syntax for using the ODS statement in SAS is −
ODS outputtype PATH path name FILE = Filename and Path STYLE = StyleName ; PROC some proc ; ODS outputtype CLOSE;
Following is the description of the parameters used −
PATH represents the statement used in case of HTML output. In other types of output we include the path in the filename.
Style represents one of the in-built styles available in the SAS environment.
Creating HTML Output
We create HTML output using the ODS HTML statement.In the below example we create a html file in our desired path. We apply a style available in the styles pbrary. We can see the output file in the mentioned path and we can download it to save in an environment different from the SAS environment. Please note that we have two proc SQL statements and both their output is captured into a single file.
ODS HTML PATH = /folders/myfolders/sasuser.v94/TutorialsPoint/ FILE = CARS2.html STYLE = EGDefault; proc SQL; select make, model, invoice from sashelp.cars where make in ( Audi , BMW ) and type = Sports ; quit; proc SQL; select make,mean(horsepower)as meanhp from sashelp.cars where make in ( Audi , BMW ) group by make; quit; ODS HTML CLOSE;
When the above code is executed we get the following result −
Creating PDF Output
In the below example we create a PDF file in our desired path. We apply a style available in the styles pbrary. We can see the output file in the mentioned path and we can download it to save in an environment different from the SAS environment. Please note that we have two proc SQL statements and both their output is captured into a single file.
ODS PDF FILE = /folders/myfolders/sasuser.v94/TutorialsPoint/CARS2.pdf STYLE = EGDefault; proc SQL; select make, model, invoice from sashelp.cars where make in ( Audi , BMW ) and type = Sports ; quit; proc SQL; select make,mean(horsepower)as meanhp from sashelp.cars where make in ( Audi , BMW ) group by make; quit; ODS PDF CLOSE;
When the above code is executed we get the following result −
Creating TRF(Word) Output
In the below example we create a RTF file in our desired path. We apply a style available in the styles pbrary. We can see the output file in the mentioned path and we can download it to save in an environment different from the SAS environment. Please note that we have two proc SQL statements and both their output is captured into a single file.
ODS RTF FILE = /folders/myfolders/sasuser.v94/TutorialsPoint/CARS.rtf STYLE = EGDefault; proc SQL; select make, model, invoice from sashelp.cars where make in ( Audi , BMW ) and type = Sports ; quit; proc SQL; select make,mean(horsepower)as meanhp from sashelp.cars where make in ( Audi , BMW ) group by make; quit; ODS rtf CLOSE;
When the above code is executed we get the following result −
Advertisements