You are on page 1of 5

(3)Report Writing

Create Report Using PROC PRINT



Syntax
Proc Print Data = XXX <options>;
Var XXXX;
Run;

Commonly used options/statements:
-Noobs
-double
Comparison Operator Vs. Logical Operator
Use WHERE statement to select certain observations
-If statement can not be used in Proc Step, but can be used in Data Step

Comparison Operator:
eq or = means equal to
ne or ^= means not equal to
gt or > means greater than
lt or < means less than
ge or >= means greater or equal to
le or <= means less or equal to

Logical Operator:
AND & - If both conditions are true, then compound condition is true
OR | - If either condition is true, then compound condition is true
NOT Opposite condition
Enhance Report With TITLE and FOOTNOTE
TITLE and FOOTNOTE
-Remain in effect until change
-Up to 10 TITLE and FOOTNOTE can be specified
-Issue empty TITLE and FOOTNOTE statement to reset
Enhance Report With LABEL
Syntax
LABEL variablename = text;
Need to use LABEL option within PROC PRINT to see the effect
Enhance Report With SAS Format
Format is a way to represent the data
Format does not change the data itself
SAS Formats are ready to use
Common SAS Format:
Dollarw.d
commaw.d
w.D
w.
Datew.
Mmddyyw.
Reading missing values in raw data
Reading missing values
-Using MISSOVER option to read missing values at the end of a record. Note that
the MISSOVER option works when missing values are at the end

Using DSD option to read missing values at the beginning or middle of a record.
DSD set the default delimiter to a comma
DSD treats two consecutive delimiters as a missing value
DSD removes quotation marks from values
Use DLM= option to change the default delimiter from comma to other symbol

You might also like