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.

multiple conditions

Unread postby akk » Sat Sep 25, 2021 8:22 am

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
set y= 0
Posts: 4
Joined: Mon Aug 30, 2021 7:46 am

Re: multiple conditions

Unread postby TomDoan » Wed Oct 20, 2021 10:59 am

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.
Posts: 7457
Joined: Wed Nov 01, 2006 5:36 pm

Return to Help With Programming

Who is online

Users browsing this forum: No registered users and 4 guests