Week 3 Flashcards
Data step commands
Output
If var in (‘A’, ‘B’, ‘C’) then output;
Delete
If var = x then delete
Where
(Where = (var = x)); can be done on a proc step too
IF-THEN-ELSE
IF-THEN-ELSE statements are linked. Else is conditional on the previous IF. If first condition is true then SAS skips the linked Else statement. SAS executes IF-THEN statements until it encounters its first true statement
Logical operators
And- must meet all requirements
Or- must meet any requirement
Not
Use parentheses to frame options
Else if (cars= ‘Jetta’ and car= x)
Length
Length var $ 10.;
PROC CONTENTS
Gives detailed summary of dataset.
View a list of SAS datasets in an active library by using
PROC CONTENTS DATA= Perm.ALL NODS;
NODS is no detailed summary
DO….END;
Used in data step with IF-THEN statements to execute multiple statements after the THEN DO. DO must be followed by END
IF year > 2000 then DO;
X=Y;
P=R;
END;