multiple conditions

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
akk
Posts: 4
Joined: Mon Aug 30, 2021 7:46 am

multiple conditions

Unread post by akk »

I want to set the value of a series based on whether 6 conditions are simultaneously true. (This involves the absolute value of various lags of the series falling into various ranges.) I was going to use a loop, but don't see how I can string together all the conditions.

I am hoping there is some version of

if ( abs(x) < ZZ and abs(x-1) > QQ and ....)
set y = 1
else
set y= 0
Thanks
TomDoan
Posts: 7665
Joined: Wed Nov 01, 2006 4:36 pm

Re: multiple conditions

Unread post by TomDoan »

The logic has to be inside the SET expression:

set y = (abs(x)<zz.and.abs(x-1)>qq.and.other conditions)

The value of Y will be 1 if all the AND conditions are met and 0 otherwise.
Post Reply