Help using Base SAS procedures

How to show observations based on a variables answer

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 10
Accepted Solution

How to show observations based on a variables answer

Wow I had a really hard time describing my question but basically I have a variable called Order_type_label which can either be Web, Instore, or Catalogue and I need to create a data set that only contains records where Order_type_label is either Web or Catalogue.

 

Here's what i have for now: 

 

data quick;

set orders;
where Order_Type_Label eq "Web" OR "Catalogue";
run;

 

I keep getting this note and the output just shows all the observations. 

NOTE: There were 490 observations read from the data set WORK.ORDERS.
WHERE 1 /* an obviously TRUE WHERE clause */ ;

 

What am I doing wrong? When I use AND instead of OR it also obviously doesnt work... 


Accepted Solutions
Solution
‎04-20-2017 11:47 PM
Esteemed Advisor
Posts: 7,055

Re: How to show observations based on a variables answer

use:

 

where Order_Type_Label in ("Web", "Catalogue");

Art, CEO, AnalystFinder.com

 

View solution in original post


All Replies
Solution
‎04-20-2017 11:47 PM
Esteemed Advisor
Posts: 7,055

Re: How to show observations based on a variables answer

use:

 

where Order_Type_Label in ("Web", "Catalogue");

Art, CEO, AnalystFinder.com

 

Occasional Contributor
Posts: 10

Re: How to show observations based on a variables answer

Thank you so much it worked! Smiley Happy
Super User
Posts: 1,066

Re: How to show observations based on a variables answer

Please try

data quick;
set orders;
where Order_Type_Label in ( "Web" "Catalogue");
run;
Thanks,
Jag
Highlighted
Occasional Contributor
Posts: 10

Re: How to show observations based on a variables answer

thank you that worked! Smiley Happy
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 72 views
  • 0 likes
  • 3 in conversation