BookmarkSubscribeRSS Feed
cberryman
Calcite | Level 5

Hello!

Can anyone explain to me how to create a where statement with three conditions? I am running an ANOVA test and I want to only include responses where the indic variable equals 0, where the maxiwhite variable equals 0, and where the maxdidsa equals 0. This is the code I have, and there were no problems in the log, but I want to make sure set it up correctly and don't need to put the three where statements together before the ANOVA.

 

data gpa;
set import;

where indic = 1;
where also maxiwhite = 0;
run;

proc anova; class mipell; model mfinalgpa = mipell; means mipell / tukey; where maxdidsa = 1;
run;

 

Thank you!!

2 REPLIES 2
PaigeMiller
Diamond | Level 26

How about this:

 

proc anova data=import(where=(maxdidsa = 1 and indic=1 and maxiwhite=0));
  class mipell; 
  model mfinalgpa = mipell; 
  means mipell / tukey; 
run;
--
Paige Miller
ChrisNZ
Tourmaline | Level 20

You syntax is correct, but creating an intermediate table is unnecessary and wasteful.

proc anova data=IMPORT;
  where MAXDIDSA=1 and INDIC=1 and MAXIWHITE=0; 
  class MIPELL;
  model MFINALGPA = MIPELL;
  means MIPELL / tukey; 
run;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1204 views
  • 0 likes
  • 3 in conversation