SAS P1 L4c Flashcards
Name some special WHERE operators
(5 plus a repeat)
CONTAINS
BETWEEN … AND
WHERE SAME AND
IS NULL or IS MISSING
LIKE
CONTAINS operator
what is it?
symbol?
Mnemonic?
Definition?
What does it do?
Case sensitive?
CONTAINS operator:
special WHERE operator
symbol = “?”
Mnemonic: CONTAINS
definition: includes a substring
CONTAINS checks if value contains substring
- position in substring doesn’t matter
CASE SENSITIVE
Special WHERE operators:
how define an inclusive range?
BETWEEN … AND
Special WHERE operators:
how augment a WHERE expression?
WHERE SAME AND
Special WHERE operators:
how check for missing value? (2 ways)
characters?
numeric?
IS NULL
IS MISSING
both work for character and numeric
Special WHERE operators:
how check for matching a pattern?
LIKE
LIKE
What does it use?(2) how many char work for?
consecutive?
how many can use in same pattern?
how express statement to match?
Uses 2 special symbols
% - can replace any number of characters (can be zero too)
_ (underscore) - replaces one character
can have consecutive underscores
can use both in same pattern
Need to be in quotes (entire statement) to match
What is an ID Statement?
ID Statement:
Used in PROC PRINT to specify different info to print instead of obs column
What does PROC SORT do?
what does it sort on?
types?
in what order does it sort?
PROC SORT:
can SORT on one or multi variables
char or numeric
ascending or descending order
How does PROC SORT work?
First?
Then?
Where does it put everything?
PROC SORT
first rearranges obs in input data set
then SAS creates data set that contains rearranged obs either by replacing original data set (= default)
or by creating new data set:
- this is optional, would need semicolon after
What’s needed for PROC SORT?
Number of statements?
PROC SORT needs three statements:
PROC SORT DATA= statement
(needed to specify data set)
BY statement - one or more BY variables
RUN statement
FORMAT of BY statement?
default?
what if want descending? for more than one var?
BY BY-variable(s)
(default is ascending)
need to specify descending in front of each variable wanted in descending order
Where else can use BY statement?
Can use BY statement in PROC PRINT too
- to group data
- data needs to already be sorted
Assigning Titles and Footnotes:
Where do titles appear?
Footnotes?
What are default title, footnote?
Titles are at top of page
Footnotes at bottom
Default title = “SAS System”
No default footnote
Syntax of TITLE?
Syntax of FOOTNOTE?
How change line printed on? default?
does quote type matter?
What kind of statements are they?
TITLEn ‘text’;
FOOTNOTEn “text”;
n indicates on which line title / footnote appears
If no number, assumes line 1
quotes around text can be single or double
TITLE and FOOTNOTE are GLOBAL statements