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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1099 views
  • 0 likes
  • 3 in conversation