sas

Reply
Contributor
Posts: 59

sas

data t;
set test1;

if rating between 2 and 5;

run;

 

getting error .Can't we use between with If?

Grand Advisor
Posts: 17,360

Re: sas

No you can't use between with IF.

You can use it with WHERE - it's a SQL operator.

 

Please consider adding more descriptive subject lines, it's helpful for understanding and for future users who are searching the forum.

Grand Advisor
Posts: 10,211

Re: sas

In a datastep you could use

data t;
   set test1;
   if 2 <= rating <= 5;
run;
data t;
   set test1;
   if 2 < rating < 5;
run;
data t;
   set test1;
   if rating >= 2 and rating <= 5;
run;

Or other comparison operators such as LT LE GT GE depending on how you want the end point treated.

 

Ask a Question
Discussion stats
  • 2 replies
  • 263 views
  • 1 like
  • 3 in conversation