5. IF WHERE
Data step only Not used with RAW
data in data step
Reading in RAW
data
SAS datasets
Inside a PROC
statement
• Do the same thing
• Applied in different places
Rules for If & Where
9. Operator Description Example Matches
IS
MISSING
Matches a missing
value
where gender is missing; A missing character value
IS NULL Equivalent to IS
MISSING
where age is null; A missing numeric value
BETWEEN
AND
An inclusive range where age between 20 and 40; All values between 20
and 40, including 20 and
40
CONTAINS Matches a substring where name contains 'MAC'; MACON, IMMACULATE
LIKE Matching with
wildcards
where name like 'R_N%'; RON, RONALD, RUN,
RUNNING
=* Phonetic matching where name =* 'NICK'; NICK, NACK, NIKKI
WHERE statement allows for additional operators
The Where Statement (2 of 2)
14. One-to-Many Joins (1 of 2)
Student_ID Gender
001 F
002 M
003 M
004 F
Student_ID Course_Title
001 Psychology 101
001 Philosophy 105
001 Math 212
002 Writing 222
002 Psychology 101
002 Spanish 301
… …
15. One-to-Many Joins (2 of 2)
Student_ID Gender Course_Title
001 F Psychology 101
001 F Philosophy 105
001 F Math 212
002 M Writing 222
002 M Psychology 101
002 M Spanish 301
… … …
25. Collection of elements defined as a single group
Allow us to write SAS statements referencing a
group of variables.
Different than arrays in many other programming
languages.
SAS Array
36. • Create subsets of data
• Combine two or more data sets
• Utilize knowledge of SAS arrays
Summary - Learning Objectives
37. “This workforce solution was funded by a grant awarded by the U.S. Department of Labor’s
Employment and Training Administration. The solution was created by the grantee and does not
necessarily reflect the official position of the U.S. Department of Labor. The Department of Labor
makes no guarantees, warranties, or assurances of any kind, express or implied, with respect to such
information, including any information on linked sites and including, but not limited to, accuracy of the
information or its completeness, timeliness, usefulness, adequacy, continued availability, or ownership.”
Except where otherwise stated, this work by Wake Technical Community College Building Capacity in
Business Analytics, a Department of Labor, TAACCCT funded project, is licensed under the Creative
Commons Attribution 4.0 International License. To view a copy of this license, visit
http://creativecommons.org/licenses/by/4.0/
Copyright Information