Creating SAS reports
In this SAS tutorial, you will learn how to use the Import data facility on the Utilities tab to import data and you will learn how to create SAS reports using list data task. So What is list data task? The list data task displays the content of he tables as a reports. So as a first step of creating SAS reports, let us create a simple listing using List data task.
In SAS, reports can be generated using REPORT and TABULATE procedures. After picking a procedure, the next step is to use the Output Delivery System (ODS) to turn it into a web page, PDF file, Word document, PowerPoint slide, or Excel spreadsheet.
- SAS reports can be categorised as Detail SAS reports, Summary SAS reports and multiple SAS reports.
Creating Listing using list data task.
In this example, we are going to use built-in Sashelp data set called Cars. This Cars data set contain information about cars model, type, origin, Drive Train, MSRP, Engine size, No of cylinders, Car horse power, Weight, Wheelbase, length and many more. Let us create a listing using Cars data set.
- To open navigate to Tasks and Utilities | Task | Data | List Data (double click).
Double click on List data and list data task setting screen will be displayed. In this step, click on the icon at the top-right part of the screen to select the library and data set (Cars).
Select Cars data set from SASHELP library and click on OK button. In the next step, we have to select the variables (column) which you want to include in listing. Click on plus sign (+) to add column as shown in above image.
Now select the list of variables (Columns) to your listing. In this example, we selected Model, Type, Origin, EngineSize, Horsepower, Weight and Invoice.
- Click Ok button.
To customise the listing like number of rows to display, display row number, column labels, column names, split labels, heading direction and column width.
Uncheck Display row number checkbox to exclude Obs column in the listing. As shown above, we choose use column labels as column headings and Rows to list (First n rows).
- Click on Run icon to generate listing of the first 10 Cars Data set.
Program code
/*
*
* Task code generated by SAS Studio 3.71
*
* Generated on '7/3/18, 4:39 PM'
* Generated by 'sasdemo'
* Generated on server 'LOCALHOST'
* Generated on SAS platform 'Linux LIN X64 2.6.32-696.20.1.el6.x86_64'
* Generated on SAS version '9.04.01M5P09132017'
* Generated on browser 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Safari/605.1.15'
* Generated on web client 'http://localhost:10080/SASStudio/371/main?locale=en_US&zone=GMT%252B05%253A30&http%3A%2F%2Flocalhost%3A10080%2FSASStudio%2F371%2Findex='
*
*/
title1 "List Data for SASHELP.CARS";
proc print data=SASHELP.CARS
(obs=10) label round;
var Model Type Origin EngineSize Horsepower Weight Invoice;
run;
title1;