The next step to improve this simple report is to include format and label information, along with titles.First the code:
ExamplePROC PRINT DATA=MEDICAL WIDTH=FULL;
The first thing to notice is the use of both a LABEL option on the PROC PRINT statement O and a separate LABEL statement ©.These do different things.The LABEL statement defines a set of variable labels which can be used instead of variable names as the column headings.The LABEL option tells the system to actually use the labels that are created in the LABEL statement.Just creating the labels in the statement without turning them on with the option will not do the trick.An aside: you created the variables'labels in this PRINT procedure.They also could have been created with a LABEL statement in the DATA step that was used to create the data set MEDICAL.
The difference in the two placements is as follows: when a LABEL statement appears in a procedure, it makes available a set of labels for that procedure only. When a LABEL statement is used in a DATA step (when the data set is being created),the labels are available for any subsequent procedures which operate on the data set.
The next enhancement is the formatting of the COST, SUB_ID, ADMIT_DT, and DISCH_DT variables.This is done with the FORMAT statement 0.This statement, like the LABEL statement,also could have appeared in the DATA step.Unlike the LABEL statement,it does not have to be turned on with a separate option.Notice that the SSN11. format adds the leading zeroes as well as the dashes to the data when displaying them as Social Security numbers. Pretty slick! The DOLLAR/, format also automatically includes the commas.
The final enhancement in this example to make the output more useful and readable is to use titles. © In Example 1 you saw the default SAS System title (the words "The SAS System"),the time and date of the run, and the page number.In this example you create your own custom titles. Titles in TITLE statements are enclosed in quotation marks, either single or double but they must match.
You can have up to 10 title lines (TITLE and TITLE 1 are equivalent.)Titles are not specifically PROC PRINT statements - they can be used anywhere in a SAS program.They remain in effect until they are replaced or nullified with null TITLE statements of the form TITLEn;this will clear all titles of number n or greater.)Here is the resulting output from Example 3:
Output from Example - Increasing Readability
Notice that the labels you create are automatically split into multi-row labels by the system as it sees fit. If you want to, you can instruct the system how to split the labels by defining a split-character on the PROC PRINT statement with the SPLTT=char option, and then placing your chosen character in the labels where you want the line splits to occur.
Note that the SPLIT= option implicitly includes the LABEL option - it is not necessary to code the LABEL option when defining a split-character. This code defines the asterisk (*) as a split character and creates the following labels:PROC PRINT DATA=MEDICAL LABEL SPLIT='*';
Labels produced using the * split-character appear as follows:
SAS Programming Related Tutorials
|SASS (Syntactically Awesome Style sheets) Tutorial||R Programming language Tutorial|
SAS Programming Related Interview Questions
|Logistics Interview Questions||SAS Programming,SQL server Interview Questions|
|Clinical SAS Interview Questions||SASS (Syntactically Awesome Style sheets) Interview Questions|
|SQL Server Analysis Services (SSAS) Interview Questions||R Programming language Interview Questions|
|SAS DI Interview Questions||Advanced SAS Interview Questions|
|Base Sas Interview Questions||SAS Macro Interview Questions|
|Clinical Data Management Interview Questions|
Sas Programming Tutorial
Input And Infile
Set, Merge, And Update
Table Lookup Tools
Proc Means And Proc Uimivariate
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.