Making a Report Flashcards
Notation and facts about:
- Block comment (and 3 facts about them)
- Comment statement
Block comments: /* comment */
- Can be any length and contain semicolons.
- Cannot be nested.
- Avoid placing in first or second columns because SAS might interpret them as signal to end job or session
Comment statement: * comment statement ;
- They can begin in columns 1 and 2
- Cannot contain internal semicolons
4 common syntax errors
invalid options, missing semicolons, unmatched quotation marks, and misspelled keywords
Is a user-created library automatically available in a SAS session?
NO, must assign a libref to make it available.
LIBNAME statement
LIBNAME libref ‘filepath’
filepath = physical location of the library
Note: does not need a run statement
rules for naming libref
- 1-8 characters long
- Must begin with letter or underscore
- Remaining characters can be letters, numbers, or underscores
T or F: Macro variables can be referenced in double or single quotation marks
False. Macro variables can only be referenced in double quotation marks
- How do you generate a report of a library’s contents?
- How do you suppress descriptors data of each individual file in the library?
- PROC CONTENTS DATA = libref._ALL_;
RUN;
- PROC CONTENTS DATA = libref._ALL_ nods;
RUN;
nods = no descriptors
(make sure to add space before nods)
How do you distinguish numerical and character variables on a table?
SAS automatically displays numerical variable right-aligned and character variables left-aligned
How to dissociate a library?
LIBNAME libref clear;
How does SAS display missing values for character and numeric variables?
Character: blank
Numeric: . (period)
Change what SAS displays for missing numeric values
MISSING = ‘character’
Length for character and numeric values
Character: 1 - 32,767 bytes
Numeric: 8 bytes (16 or 17 significant digits)
Rules for naming variables
- Can be 1 -32 characters long
- Start with letter or underscore
- Can contain numbers, letters, or underscores
- Can be uppercase or lowercase
- After variable is created, can refer to it in any case in code without affecting way in which it’s stored
How to add totals of several variables within one SUM statement
Separate variable with blank:
SUM var1 var2;
Which statement do you use to choose specific variable to display in a report?
VAR