Where statement - selection of multiple items

Reply
Occasional Contributor
Posts: 5

Where statement - selection of multiple items

[ Edited ]

excluding one observation from reg analysis, its work eg.

 

proc reg data=khan.crime;
model crime= pctmetro poverty single;
where state ne "dc";
run;

 

but don't know how to exclude two observations.

SAS Super FREQ
Posts: 8,820

Re: Regression

Hi:
Investigate the use of the IN operator. For example:
where city not in ('Atlanta' 'Boston');
or
where age not in (12, 13,14);
or
where muppet not in ('Kermit', 'Elmo');
or
where numsold not in (1 2 3);

The commas in a WHERE with an IN are optional. I like them because they make it easier to read (I think), but I know that they are optional.

cynthia
Super User
Posts: 9,875

Re: Where statement - selection of multiple items

Or make a weight variable.

 

data have;

 set crime;

if state in ('nc' 'ma')  then wt=.;

 else wt=1;

 

proc reg;

..........

weight wt;

Ask a Question
Discussion stats
  • 2 replies
  • 169 views
  • 2 likes
  • 3 in conversation