Using the WIDTH=MINIMUM Option - SAS Programming

Here is the same program and output with the WIDTH option set to equal MINIMUM:

Example

PROC PRIM DATA=MEDICAL WIDTH=MINIMUM?
TITLE 'WIDTH option MINIMUM'j
VAR SUB__ID
DIAGCODE
ADMIT_DT
DISCHJ3T
HOSPCODE
LOS
COST?
FORMAT COST DOLLAR?.
SUB_ID SSH11.
ADMIT^DT DISCHJ)T MMDDYY8.j
RUN;

Output from Example - Using the WIDTH=MINIMUM Option

Output from Example - Using the WIDTH=MINIMUM Option

Notice that the WIDTH=FULL option produces a report which takes up more room. Using this option causes PROC PRINT to use the formatted widths of variables, if supplied, or default widths if you do not supply formats (for character variables,these are the lengths of the variables as defined in the data set; for numeric variables,a width of 12 is used).Since the width of each variable is constant for all observations,reports that span more than one page all have the same total column widths.

The WIDTH=MINIMUM option uses the minimum width necessary to display the data on a given page for each column.Therefore, a multi-page report may use different column widths on different pages and the total column width may vary from page to page.This can cause a quite obvious non-uniformity in the display from page to page.

A nice compromise between the two options shown above is WIDTH=UNIFORM.If a variable is formatted,this option uses the associated format to define the column width.If a variable is not formatted,this option uses the widest data value for a variable to display all values of that variable.

The UNIFORM value usually uses narrower column widths than FULL and may use wider widths than MINIMUM,but UNIFORM has the advantage of providing the same individual column width for each variable throughout and, therefore,the same overall page column width throughout, even if the report spans multiple pages. Note that both MINIMUM and UNIFORM take a bit more CPU time than FULL (if you are concerned about such things).

Controlling the Orientation of the Column Headings

The reports so far in this chapter all have the column headings printed horizontally.In certain circumstances (when the column widths are small and the variable names are large),PROC PRINT may decide to print the column headings vertically.If you want to override the orientation of the column headings,use the PROC PRINT options HEADING=HORIZONTAL or HEADING =VERTICAL to specify the orientation.For example,to force PROC PRINT to print the column headings horizontally, write:

PROC PRINT HEADING=HORIZONTAL;

Problems

  1. You have a SAS data set DONOR which contains variables L_NAME, F_NAME, AMOUNT (of donation),and DATE(of donation.) Write the code to produce a simple report from DONOR.The report should list the variables in the following order: F_NAME,L_NAME,DATE (in MM/DD/YY format),and AMOUNT (using DOLLARS, format).
  2. Here are some sample data to work with:

    Controlling the Orientation of the Column Headings

  3. Write the code to produce the following report from the DONOR data set described in Problem 9-1,including the two-line title,column headings, date format, observation count, and sum of donations. Note that the title is flush left (starts at the left margin) and does not include the date or page number.
  4. report from the DONOR data set

  5. Using the same DONOR data set from Problems 9-1 and 9-2, write the code to generate simple reports with the following characteristics:
      a) variable names printed vertically and minimum width assigned to the columns
      b) horizontal column headings and uniform printing (if the report actually ran over several pages).

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

SAS Programming Topics