Generating Reports.doc - Topic Generating Reports 1...

Info icon This preview shows pages 1–5. Sign up to view the full content.

Topic: Generating Reports 1. Generating reports using the PRINT procedure 2. Generating frequency tables using PROC FREQ procedure 3. Generating report using MEANS procedure 4. Generating report using REPORT procedure 5. Enhancing report through the use of labels, SAS format, titles, footnotes and SAS System reporting options 6. Introduction to ODS 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

1. PROC PRINT PROC PRINT lists the values of the variables in a SAS data set in the output window. The PROC PRINT procedure you are able to use prints the observations in a SAS data set, using all or some of the variables. You can create a variety of reports ranging from a simple listing to a highly customized report that groups the data and calculates totals and subtotals for numeric variables. The VAR statement tells SAS to print only the variables listed and in the order given. Prints a listing of the values of some or all of the variables in a SAS data set. The PRINT procedure can be controlled by the following statements: o PROC PRINT options; o ID variable-list; o VAR variable-list; o BY variable-list; o PAGEBY by-variable; o SUMBY by-variable; o SUM variable-list; Useful Options... o Double - double spaces the printed output. o Label - uses variable labels as column headings (variable name is default heading). o Noobs - suppresses the observation number in the output. Example 1 List containing all the variables and all the observations. data a; input year sales cost; profit=sales-cost; cards ; 1981 12132 11021 1982 19823 12928 1983 16982 14002 1984 18432 14590 ; run ; proc print data =a; title 'Simple PROC PRINT Report' ; run ; Example 2 Removal of column OBS and impression limited to the first 5 observations. data exprev; input Region $ State $ Month monyy5. Expenses Revenues; format month monyy5. ; datalines ; Southern GA JAN95 2000 8000 Southern GA FEB95 1200 6000 2
Image of page 2
Southern FL FEB95 8500 11000 Northern NY FEB95 3000 4000 Northern NY MAR95 6000 5000 Southern FL MAR95 9800 13500 Northern MA MAR95 1500 1000 ; proc print data =exprev( obs = 5 ) noobs ; var month state expenses; title 'Monthly Expenses for Offices in Each State' ; run ; Example 3 Instruction ID with not sorted observations data bid; input id age; datalines ; 987 65 687 75 254 55 236 70 ; proc print ; run ; Example 4 Instruction ID, after sorting of the observations. data bid2; input pat_id age; datalines ; 987 65 687 75 254 55 236 70 ; proc sort ; by pat_id; run ; proc print ; *var pat_id; id pat_id; run ; Example 5 Test of one or the other condition, instruction WHERE data bid3; input pat_id age; datalines ; 987 65 687 75 254 55 236 70 ; proc sort ; by pat_id; run ; proc print noobs ; var age; 3
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

where age < 75 ; run ; Example 6 Instruction SUM. data trim; input vendor $ mois quantite COMMA5. tot_vendor comma11.2 ; datalines ; Hollingsworth 04 530 10,573.50 Hollingsworth 05 1,120 22,344.00 Hollingsworth 05 1,030 20,548.50 Jones 04 1,110 22,144.50 Jones 04 675 13,466.25 Smith 04 1,715 34,214.25 Smith 06 512 10,214.40 Smith 06 1,000 19,950.00 ; run ; PROC PRINT DATA =trim NOOBS ; TITLE 'Total of variables names' ; VAR vendor mois quantite tot_vendor; WHERE quantite> 500 OR tot_vendor> 20000 ; SUM quantite tot_vendor; RUN ; Example 7 Instructions SUM and BY statement data trim2; input vendor $ mois quantite COMMA5. tot_vendor comma11.2 ; datalines ; Hollingsworth 04 530 10,573.50 Hollingsworth 05 1,120 22,344.00 Hollingsworth 05 1,030 20,548.50 Jones 04 1,110 22,144.50
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '17
  • Mean, PROC

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern