BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
yael
Quartz | Level 8

Hello,

 

I have a data of 4300 lines which now I want to take only part of data for regression.

I have a continouse variables which called FOWNFF, FOWNFNF, DG while nf is 0,1 variable

 

I want that my population will be: FOWNFF>0.2 and FOWNFNF>0.2 and if nf=1 than take the variable while it is DG>0.2

where fownff>0.2 and fownfnf>0.2 if nf=1 and dg>0.2;

 

that is what I wrote and got an error. The log is:

ERROR: Syntax error while parsing WHERE clause.

ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &, *, **, +, -, /, <, <=, <>, =, >, >=, AND, EQ, GE, GT,

LE, LT, NE, NOT, OR, ^, ^=, |, ||, ~, ~=.

ERROR 76-322: Syntax error, statement will be ignored.

 

Any help will be acceptable

 

Thanks

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

The statement must either be a where (which means a where condition that is applied directly on the input data before the data step iteration begins) or an if (subsetting if, is processed at the place it is written in the data step).

Within both, you need to define a condition that yields a boolean value (in SAS, this means a numeric value; 0 is false, any non-zero value - usually 1 - is true).

So, if is not allowed within the where condition. You need to build your condition using and, or and not as logical (boolean) operators.

where
  nf = 0 and fownff > 0.2 and fownfnf > 0.2
  or
  nf = 1 and dg > 0.2
;

Note that logical and takes precedence over logical or in the evaluation, so no parentheses are needed.

View solution in original post

1 REPLY 1
Kurt_Bremser
Super User

The statement must either be a where (which means a where condition that is applied directly on the input data before the data step iteration begins) or an if (subsetting if, is processed at the place it is written in the data step).

Within both, you need to define a condition that yields a boolean value (in SAS, this means a numeric value; 0 is false, any non-zero value - usually 1 - is true).

So, if is not allowed within the where condition. You need to build your condition using and, or and not as logical (boolean) operators.

where
  nf = 0 and fownff > 0.2 and fownfnf > 0.2
  or
  nf = 1 and dg > 0.2
;

Note that logical and takes precedence over logical or in the evaluation, so no parentheses are needed.

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 775 views
  • 2 likes
  • 2 in conversation