Skip to content

Instantly share code, notes, and snippets.

@SolClover
Created August 8, 2020 02:55
Show Gist options
  • Save SolClover/a408afdb79c9743eb989b3ac205eb0e8 to your computer and use it in GitHub Desktop.
Save SolClover/a408afdb79c9743eb989b3ac205eb0e8 to your computer and use it in GitHub Desktop.
SAS filtering using where statement
/* Filter on one condition */
data my_new_ds;
set my_ds;
where Col_A>=6;
run;
/* Filter on multiple conditions using AND */
data my_ds;
set my_ds;
where Col_A>=6 and Col_B=5;
run;
/* Filter on multiple conditions using OR */
data my_ds;
set my_ds;
where Col_A>=6 or Col_B=1;
run;
/* Filter on multiple conditions */
data my_ds;
set my_ds;
where fruit in ('1.apple', '3.pear');
run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment