Complete Guide To The SAS Report Procedure

1y ago
10 Views
2 Downloads
807.98 KB
12 Pages
Last View : 14d ago
Last Download : 3m ago
Upload by : Macey Ridenour
Transcription

P a r t1Getting Started3Chapter 1Creating a Simple ReportChapter 2PROC REPORT: An IntroductionChapter 3Creating BreaksChapter 4Only in the LISTING DestinationChapter 5Creating and Modifying Columns Using the Compute Block13577597You can use the REPORT procedure to generate a wide range of sophisticated tables and reports. Thecode can be complex or fairly straightforward. This part of the book shows you how to create fairlysimple reports using the basic statements and their options.

2 Carpenter’s Complete Guide to the SAS REPORT Procedure

C h a p t e r1Creating a Simple Report1.1 Basic Syntax 41.2 Routing Reports to ODS Destinations 61.3 Other Reporting Tools: A Brief Comparison of Capabilities 71.3.1 PROC REPORT vs. PROC PRINT 81.3.2 PROC REPORT vs. PROC TABULATE 81.3.3 PROC REPORT vs. DATA NULL 81.4 The PROC REPORT Process: An Overview 91.4.1 PROC REPORT Terminology 91.4.2 Processing Phases 111.5 Chapter Exercises 12The syntax for PROC REPORT is quite different from that of most other Base SAS procedures. Inmost procedures, the supporting statements define the scope and options of the procedure. In aPROC REPORT step, on the other hand, the statements refer to and build on each other.PROC REPORT can be used in two different modes, batch and interactive. This book discussesthe syntax of PROC REPORT in the batch environment, and does not discuss the interactive orwindowing environment.

4 Carpenter’s Complete Guide to the SAS REPORT Procedure1.1 Basic SyntaxLike most procedures, PROC REPORT can be executed with a minimal understanding of even themost basic syntax.In its simplest form, PROC REPORT is similar to PROC PRINT in that it creates a data listing.Here is the minimum coding required:PROC REPORT;run;By default the REPORT procedure opens an interactive windowing environment. Thisenvironment is not normally used and is not discussed in this book. The following is the simplestPROC REPORT step that does not open the interactive windowing environment:PROC REPORT nowd;nrun;When executed, this simple step creates a listing of all rows and all columns in the most recentlymodified data table. This plain vanilla result is of course rarely what we need or want, so we mustknow more in order to create the report that we actually do need.Some of the basic statements used in PROC REPORT include the following:PROC REPORT Y DATA datasetname options ;COLUMN variable list and column specifications;DEFINE column / column usage and attributes;COMPUTE column; compute block statements; ENDCOMP;RUN;A number of options and modifiers can be used along with these statements. Most of these arediscussed throughout this book. To locate the discussion of a specific statement, option, or modifier,see Appendix 2, which provides a syntax and example reference locator for this book.You can use the REPORT procedure to build reports interactively (LeBouton 2004). Whileappealing in concept, in practice this feature is rarely used and is not discussed in this book.Unfortunately, the procedure default is to initiate the interactive mode. You can disable this madeby using either the NOFS, NOWD, or NOWINDOWS option. NOWD n is most often used in thedocumentation and in SAS literature.As for most procedures that operate against data tables, you will want to be able to specify whichtable PROC REPORT is to display. oThe DATA option is used for this specification in theREPORT procedure as it is in so many other SAS procedures.A number of supporting statements are used in the PROC REPORT step. The followingstatements are three of the most common:COLUMNDEFINEidentifies all variables (report items) used in the generation of the table.specifies how the column is to be used and what its attributes are to be.One DEFINE statement is used for each variable in the COLUMNstatement.COMPUTE creates new columns and performs column-specific operations.

Chapter 1: Creating a Simple Report 5The following PROC REPORT step creates a simple listing of a select few of the twenty or sovariables in the RPTDATA.CLINICS table:* Simple report;options nocenter;title1 'Using Proc REPORT';title2 'Simple Report';proc report data rptdata.clinics nowd;columns region lname fname wt;define region / display;define lname / display;define fname / display;define wt / display;run;Here are the first few lines of the generated report.Using Proc REPORTSimple Reportregion56924584last rstnameMaryTerrieHeidiLizTedRobertJuneKurtweightin pounds215187177109201158158179. . . Portions of the report are not shown . . .A quick inspection of the output listing shows both similarities and differences between PROCREPORT and PROC PRINT. As in PROC PRINT, variables/columns are listed across the page,while rows/observations are listed down the page. Unlike PROC PRINT, there is no OBS column,and the default is to print the variable label instead of the variable name. “Pretty” is not a defaultcharacteristic, and the remainder of this book is devoted to controlling how the report looks.Notice in this example that the default header of the column is the variable label. In Section 2.5,several examples show how you can control this text. You can also use the system optionNOLABEL to make the variable name the default column header.MORE INFORMATIONAppendix 2, “Syntax and Example Index,” is designed to help the reader navigate this book.SEE ALSOA nice introduction to the PROC REPORT windowing environment is presented by LeBouton(2004). This interactive environment was first introduced in the SAS Guide to the REPORTProcedure: Usage and Reference, Version 6 (1990).

6 Carpenter’s Complete Guide to the SAS REPORT Procedure1.2 Routing Reports to ODS DestinationsUsually we need to route the output generated by PROC REPORT to one or more OutputDelivery System (ODS) destinations. The syntax and use of ODS is outside the direct scope ofthis book. However, because we are going to depend on ODS for a great deal of the appearance ofthe output generated by PROC REPORT, it is necessary to at least discuss the basics of ODS.Since we use reports in different ways, we need to generate the reports as different types of files.We declare the type of file to be generated by specifying the ODS destination. This means thatthere is generally a correspondence between the name of the destination and the type of outputthat is to be created (e.g., HTML, PDF, RTF).Usually we surround the PROC REPORT step with what has been referred to as an ODSsandwich. The sandwich consists of two ODS statements that turn the Output Delivery System onand off. The physical name of the output file and the file’s location are included in the first ODSstatement. The second ODS statement closes (turns off) the ODS destination. In both statements,the ODS destination name immediately follows the ODS keyword.The general form of the ODS sandwich is something like this:ods destination file file name ;proc report . . . . ;. . . .run;ods destination close;If you wanted to re-create the results of the previous step as an HTML document, you might writeODS statements like the following. Note that all physical paths in the examples are created usingthe macro variable &PATH. This should make it easier for you to replicate the results of thesesame example programs on your own computer.ods html file "&path\results\simple.html";title1 'Using Proc REPORT';title2 'Simple Report';proc report data rptdata.clinics nowd;columns region lname fname wt;define region / display;define lname / display;define fname / display;define wt / display;run;ods html close;

Chapter 1: Creating a Simple Report 7Here is a portion of the HTML report:. . .Portions of the report are not shown . . .Throughout this book you will see examples of a number of other ODS statements, options, anddestinations.MORE INFORMATIONThe &PATH macro variable is used throughout the book to designate the upper portion of alllocation references and is described in more detail in “About This Book.” Appendix 2 contains alist of ODS-related references within this book. A number of other sections in this book containexamples that utilize features of ODS. Chapter 8, “Using PROC REPORT with ODS,” andChapter 9, “Reporting Specifics for ODS Destinations,” are devoted to the topic.SEE ALSOHaworth (2001, 2003) and Gupta (2003) provide very good information on the Output DeliverySystem and show how to get started using it. Kumar (2006) introduces ODS along with a PROCREPORT example.1.3 Other Reporting Tools: A Brief Comparisonof CapabilitiesSince SAS provides a variety of reporting tools, there is sometimes some confusion about whichtool should be used in a given situation. Three of the primary reporting tools are the PRINT,REPORT, and TABULATE procedures. All three have enough flexibility to produce a fairlydiverse set of reports. However, they are not the same and do not have the same overallcapabilities.All three of these procedures work well with the ODS environment, and each supports the use ofthe STYLE option (see Section 8.1 for an introduction to this option).

8 Carpenter’s Complete Guide to the SAS REPORT Procedure1.3.1 PROC REPORT vs. PROC PRINTBoth the PRINT and REPORT procedures can perform detail-level reporting (reporting ofindividual data values). Although a number of supporting statements are available, PROC PRINThas the advantage of being a fairly simple procedure and is generally one of the first proceduresthat is learned by a new user.Although both procedures are good at creating simple detail reports, the only real summarycapability of PROC PRINT is to calculate column totals. When the SUM statement is combinedwith the BY statement, SUM (and SUMBY) can calculate group and sub-group totals. UnlikePROC PRINT, PROC REPORT is not limited to group totals. PROC REPORT can calculate allof the usual statistics that can be calculated by other procedures such as MEANS, SUMMARY,and UNIVARIATE. In fact, the reason that PROC REPORT can calculate some of these samestatistics is that the MEANS/SUMMARY process is used behind the scenes for summarizing thedata set used with PROC REPORT.Most users find that PROC PRINT is fine for simple straightforward detailed reports. However, ifyou find that the limitations of PROC PRINT are causing extra work, then it is probably anindication that it is time to switch to PROC REPORT.SEE ALSOBurlew (2005, pp. 18–19) provides a comparison of the default behaviors of these two procedures.1.3.2 PROC REPORT vs. PROC TABULATEBoth the REPORT and TABULATE procedures can create summary reports, and each has accessto the same standard suite of summary statistics.Unlike PROC TABULATE, the REPORT procedure can provide detail reporting as well assummary reporting capabilities. PROC REPORT has the added flexibility to calculate and displaycolumns of information based on other columns in the report.Because of the unique way that PROC TABULATE structures the report table, it has a great dealmore flexibility to present the groups, subgroups, and statistics as either rows or columns. This isespecially true for vertically concatenated reports, which are very straightforward in PROCTABULATE and difficult in PROC REPORT (see Section 10.1).SEE ALSOBuck (1999, 2004), Bruns, Pass, and Eaton (2002), and Bruns and Pass (2004) compare thestrengths and weaknesses of these two procedures.The TABULATE procedure is fully described by Haworth (1999).1.3.3 PROC REPORT vs. DATA NULLThe DATA NULL step is a reporting tool that offers extreme flexibility. Because it uses thepower of the DATA step, this methodology enables the user to generate reports in almost anyform.Of course, this power comes with the price of complexity. Although the user has the power toplace every character “just so,” the process itself can become quite difficult. In PROC REPORT,

Chapter 1: Creating a Simple Report 9the compute block, with its access to the majority of the SAS language elements, such as logicprocessing, functions, and assignment statements, takes on some of the role of the DATANULL step.1.4 The PROC REPORT Process: An OverviewFor most procedures, the internal processing is of little interest to the average user. This shouldnot be the case for PROC REPORT. Because PROC REPORT has the capability of creatingcolumns as well as group and report summaries, the process can be quite complex. When thereport is simple, such as those in this chapter and in Chapter 2, “PROC REPORT: AnIntroduction,” the processing details are of less interest. However, as new columns are calculatedand perhaps then coordinated with report and group summaries, a more complete understandingof the process becomes critically important.MORE INFORMATIONThe timing of the compute block is discussed in Section 7.1, and a detailed presentation of theprocessing of the PROC REPORT step is provided in Chapter 11, “Details of the PROC REPORTProcess.”SEE ALSOSAS Technical Report P-258 (1993, Chapter 10), Lavery (2003), and Russ Lavery’s “AnAnimated Guide to the SAS REPORT Procedure,” which is included on the CD that accompaniesthis book, discuss the sequencing of events in detail.1.4.1 PROC REPORT TerminologySome of the terms and concepts associated with PROC REPORT are similar to those in othertypes of PROC steps. However, PROC REPORT is unique in that it allows some DATA step-typeprocessing to be performed, and thus we need some specialized words and phrases to discuss thisprocessing. Of course, the special nature of PROC REPORT results in terminology that is uniqueto this step, and an overview of basic PROC REPORT processing will highlight these terms.Term usage has evolved since the introduction of the REPORT procedure in SAS 6.06. This notonly reflects the complexity of the procedure, but also the changes in how PROC REPORToperates behind the scenes.Some of the terminology used in this book is included here.Current TerminologyTwo general types of reports can be generated by PROC REPORT. Detail reports are mostsimilar to those generated by PROC PRINT and have one line in the report, called a report row,for each observation in the incoming data set. When the incoming data is summarized orcollapsed into groups, PROC REPORT can create a summary report. PROC REPORT is flexibleenough to create a report that has characteristics of both of these types of reports.

10 Carpenter’s Complete Guide to the SAS REPORT ProcedureThe report generated by PROC REPORT is called the final report output. Columns on the finalreport output can include more than variables, so the report columns are often referred to asreport items. There are two general classes of report items used within the PROC REPORT step:report variablestemporary variablesappear in the COLUMN statement and usually in one or moreof the report columns. They may or may not be created or used inCOMPUTE blocks.are created and used in COMPUTE block calculations, but do notappear in the COLUMN statement or on the report itself.Through the DEFINE statement, report items are assigned a define type or define usage thatdetermines how the variables are to be processed by PROC REPORT. Report items can be usedduring compute block execution to build or calculate other report items. Depending on the PROCREPORT step, not all report items will necessarily be included in the final report output.PROC REPORT builds each report row, one row at a time. However, in order for summary andbreak information to be available when it is constructing summary rows, PROC REPORT goesthrough a three-phase process to create the report. The first phase is the evaluation phase, and itis during this phase that the submitted code is assessed. The final two phases are of specialinterest to the PROC REPORT programmer, and these (the setup phase and the report rowphase) are described in more detail in the section on processing phases (see Section 1.4.2).For reports that summarize the incoming data, the summary results are determined during thesetup phase and stored in memory in the computed summary information.Each line of a report is a report row; for some reports, however, report rows are generated that arenot ultimately written to the final report output. The final report output is generated one row at atime, and depending on the selection of statement options, not all summary report rows areincluded in the final report output.Outdated TerminologySince its introduction in SAS 6, PROC REPORT has been the subject of a great many papers.This unofficial documentation, as well as some of the initial official documentation, has generatedfairly extensive terminology for the internal processes of PROC REPORT. Although some of thisterminology reflects, to some degree, current internal processes, the majority has at best becomeoutdated. In order to assist readers of this older literature, the following table attempts to link theolder terminology with that used throughout this book.Older, Outdated, or Inaccurate TermsTerminology Used in This BookTemporary Internal File, TIFComputed summarized informationcomputed summary information areaReport Data Vector, RDVReport variables, report itemsDATA Step VariableTemporary variableDATA Variable Table, DVTTemporary variables are stored in memoryand no special name is needed for thislocation.DATA Step StatementDATA Step FunctionsSAS language elements

Chapter 1: Creating a Simple Report 11SEE ALSOExtensive discussion contrasting report items and temporary variables can be found in Chapter10 and more specifically on pages 250-251 of SAS Technical Report P-258 (1993). When youread SAS Technical Report P-258, remember that it reflects some of the earliest documentationavailable for PROC REPORT and does not use the current terminologies or in some cases reflectthe current processes of the PROC REPORT step.1.4.2 Processing PhasesWhen a PROC REPORT step is submitted, SAS breaks down the processing into a series of stepsor phases. All of this processing, as well as the results of the processing, including the computedsummary information, takes place in memory.Evaluation PhaseFirst, all the PROC REPORT statements are evaluated before anything else happens. The SASlanguage elements and LINE statements (if there are any) in the compute blocks are simply setaside to be executed as each report row is built (report row phase). This evaluation determines theresources and levels of summarization that will be needed during the setup phase.Setup PhaseAfter the code is evaluated, the setup phase reads and prepares the incoming data. If necessary,the columns that will be used for summarizing are sent to the MEANS/SUMMARY engine,where the summarization takes place.Report Row PhaseOnce PROC REPORT is done with these preliminary setup phase tasks and the computedsummarized information has been created, the report can be built row by row during the reportrow phase. Finally, after each report row is built, it is sent to all open ODS destinations(LISTING, HTML, RTF, PDF, etc.).Summary of the Processing PhasesThe following flowchart shows the general processing phases at the conceptual level described inthis section.It is tempting to try to impose DATA step conceptssuch as the Program Data Vector onto PROCREPORT. However, between PROC REPORT'soriginal inception with SAS 6 and subsequentupgrades and rewrites to the underlying PROCREPORT code, these primary conceptual phases(especially the setup and report row phases) shouldsuffice to explain how the final report isconstructed.Of primary importance is to remember that duringthe report row phase, processing is from left toright. The order of the variables in the COLUMNstatement (see Section 2.1), therefore, becomes veryimportant.

12 Carpenter’s Complete Guide to the SAS REPORT Procedure1.5 Chapter Exercises1. What are the three processing phases of a PROC REPORT step?2. What is the difference between temporary variables and report variables?3. What two PROC REPORT statement options will you use within virtually every PROCREPORT statement?

4 Carpenter's Complete Guide to the SAS REPORT Procedure 1.1 Basic Syntax Like most procedures, PROC REPORT can be executed with a minimal understanding of even the most basic syntax. In its simplest form, PROC REPORT is similar to PROC PRINT in that it creates a data listing. Here is the minimum coding required: PROC REPORT; run;

Related Documents:

POStERallows manual ordering and automated re-ordering on re-execution pgm1.sas pgm2.sas pgm3.sas pgm4.sas pgm5.sas pgm6.sas pgm7.sas pgm8.sas pgm9.sas pgm10.sas pgm1.sas pgm2.sas pgm3.sas pgm4.sas pgm5.sas pgm6.sas pgm7.sas pgm8.sas pgm9.sas pgm10.sas 65 min 45 min 144% 100%

May 02, 2018 · D. Program Evaluation ͟The organization has provided a description of the framework for how each program will be evaluated. The framework should include all the elements below: ͟The evaluation methods are cost-effective for the organization ͟Quantitative and qualitative data is being collected (at Basics tier, data collection must have begun)

Silat is a combative art of self-defense and survival rooted from Matay archipelago. It was traced at thé early of Langkasuka Kingdom (2nd century CE) till thé reign of Melaka (Malaysia) Sultanate era (13th century). Silat has now evolved to become part of social culture and tradition with thé appearance of a fine physical and spiritual .

SAS OLAP Cubes SAS Add-In for Microsoft Office SAS Data Integration Studio SAS Enterprise Guide SAS Enterprise Miner SAS Forecast Studio SAS Information Map Studio SAS Management Console SAS Model Manager SAS OLAP Cube Studio SAS Workflow Studio JMP Other SAS analytics and solutions Third-party Data

Both SAS SUPER 100 and SAS SUPER 180 are identified by the “SAS SUPER” logo on the right side of the instrument. The SAS SUPER 180 air sampler is recognizable by the SAS SUPER 180 logo that appears on the display when the operator turns on the unit. Rev. 9 Pg. 7File Size: 1MBPage Count: 40Explore furtherOperating Instructions for the SAS Super 180www.usmslab.comOPERATING INSTRUCTIONS AND MAINTENANCE MANUALassetcloud.roccommerce.netAir samplers, SAS Super DUO 360 VWRuk.vwr.comMAS-100 NT Manual PDF Calibration Microsoft Windowswww.scribd.com“SAS SUPER 100/180”, “DUO SAS SUPER 360”, “SAS .archive-resources.coleparmer Recommended to you b

On an exceptional basis, Member States may request UNESCO to provide thé candidates with access to thé platform so they can complète thé form by themselves. Thèse requests must be addressed to esd rize unesco. or by 15 A ril 2021 UNESCO will provide thé nomineewith accessto thé platform via their émail address.

̶The leading indicator of employee engagement is based on the quality of the relationship between employee and supervisor Empower your managers! ̶Help them understand the impact on the organization ̶Share important changes, plan options, tasks, and deadlines ̶Provide key messages and talking points ̶Prepare them to answer employee questions

Dr. Sunita Bharatwal** Dr. Pawan Garga*** Abstract Customer satisfaction is derived from thè functionalities and values, a product or Service can provide. The current study aims to segregate thè dimensions of ordine Service quality and gather insights on its impact on web shopping. The trends of purchases have