Updated March 17, 2023
Introduction to SAS ODS
SAS ODS is the output delivery system that helps produce the output format in the SAS data program to understand the ideas and data reports with additional platform support on multiple PROC statements in the file through different parameters called path representing the html output cases in other filename paths data style is an additional parameter for the default set of styles that represented in SAS environment.
Key Takeaways
- SAS ODS denoted the SAS OUTPUT DELIVERY SYSTEM.
- It is more user-friendly with the html, pdf, and RTF word document formats.
- So it will produce friendly data reports with accuracy and customized data view pattern for user understanding.
- It also shared the same output format with other Operating System Environments and Software.
- Multiple Proc statements help perform as a single file.
What is SAS ODS?
The SAS output delivery system helps to convert the data format like .html, pdf, etc., which helps to restore most of the areas in the SAS platform. It has two sets of parameters like, Path and Style; here, the path represents html set of input codes that get the appropriate output result cases, including the filename already saved with the .html format in the user location. Then the style represents the default set of methods available in the SAS environment on the proc set of SQL statements captured in the input file. The SAS dataset will be created accordingly to the ODS output statements with required output objects viewed by the record, and the same will be printed on the output console.
How to Use SAS ODS?
Using ODS, the html statement will create the file with an extension called .html format on the desired path based on the user inputs datasets output is produced, and the same will be consumed on the printed screen. It supports other extensions like pdf and word(TRF) format in the RTF file path across the data collections from the default procedure on the tools like ODS TRACE, ODS OUTPUT, SAS metadata, etc. These are some essential tools for printing the datas in the SAS environment. The SAS Graphics editor and other reporting procedures are buried with the procedural output on the demonstration that is exactly queried to retrieve the information.
Syntax of SAS ODS
Below code is the basic syntax for the formats:
ods html file='';
path="";
style="";
proc sql;
select column name1, column name2,… from table name conditional statements orders;
quit;
ods html close;
The above codes are performed like Output Delivery System to access and convert the file systems.
We used HTML, PDF, and RTF formats, extensions, and various areas here.
Steps for Creating SAS ODS
Given below are the steps mentioned:
1. Navigate to the below URL and log in to the issue.
3. Then paste the below code for generating the ODS in html format.
4. ODS HTML
5. PATH = ‘/home/u61573544/August5’
6. FILE = ‘August5.html’
7. STYLE = EGDefault;
8. proc SQL;
9. select ID, SEGMENT, DENSITY
10. from MAPSSAS.INDIA
11. where ID in (1,6)
12. Order by ID;
13. quit;
14. ODS HTML CLOSE;
15. We get the above results with the columns like GLC: Province Number, Country Segment Number, and Levels for Reducing.
16. The condition is only satisfied with this query.
17. select ID, SEGMENT, DENSITY
18. from MAPSSAS.INDIA
19. where ID in (1,6)
20. Order by ID;
21. And we get an output file with html format on the specified location like below.
22. When we double-click a file, it is downloaded, and we can view it through the browser.
How to Create HTML and PDF Output?
The Data step and ODS will help create HTML and PDF reports in the default data table template to perform the user operations. Additionally, it will help write the output object to the HTML destination and the PDF format if the user input conversion is pdf.
Example #1
Example for creating HTML Output using SAS ODS.
Code:
ODS HTML
PATH = '/home/u61573544/August5'
FILE = 'August61.html'
STYLE = EGDefault;
proc SQL;
select AMOUNT, DATE
from SASHELP.BUY
where AMOUNT in (-1000,-4000)
Order by AMOUNT;
quit;
ODS HTML CLOSE;
Output:
The above code is the basic workflow of the SAS ODS in the html format Output Display System. We can initialize the ODS HTML format at the beginning of the code and then specify the PATH, FILE, and STYLE with appropriate values. Then we can call the required table from the dataset with an output format like an HTML file.
Example #2
Example for creating PDF Output using SAS ODS.
Code:
ODS PDF
FILE = 'https://cdn.educba.com/home/u61573544/SASPDFAugust6/August61.pdf'
STYLE = EGDefault;
proc SQL;
select AMOUNT, DATE
from SASHELP.BUY
where AMOUNT in (-1000,-4000)
Order by AMOUNT;
quit;
Output:
The above example which same as the first example with html format output. Here we need to convert the data format by using the PDF view. We can use the same table with data and orders along with the FILE and STYLE paths.
Frequently Asked Questions
Other FAQs are mentioned below:
Q1. What is SAS ODS?
Answer:
It is one type of conversion in SAS and stands for output delivery system. So it delivers using the ODS keyword, which is available in the SAS.
Q2. What are the formats supported in SAS ODS?
Answer:
Currently, it supports html, pdf, and RTF formats.
Q3. How will you convert the SAS ODS to the HTML format?
Answer:
- Using ODS HTML
- Specified PATH=’’
- FILE=’name.html’
- STYLE= “”;
Q4. How will we convert the SAS ODS to PDF format?
Answer:
- Using ODS PDF
- FILE=”PATH”
- STYLE=”name”
Q5. How will it support the SAS ODS to RTF format?
Answer:
- Using ODS RTF
- FILE=’path along with filename.rtf’
- STYLE=”name”
Conclusion
The SAS ODS excludes the specific datas that may include source and destination parts. It also sets the default value, excludes ALL with other data lists, and sets it as the default value. It mainly focused on overcoming the data limitation compared to the standard SAS output.
Recommended Articles
This is a guide to SAS ODS. Here we discuss the introduction, examples, and steps for creating SAS ODS with FAQ. You may also have a look at the following articles to learn more –