Solved
Contributor
Posts: 42

# Logic Operator?

Hi,
Can someone help to decipher this code?

where,
TARGET_TKFLINK_ACQ and TARGET_PVS_ACQ are the variables, and TARGET_TKLPVS_ACQ is the product(new column).

Is this similar to the boolean operator where either one of them is true then it will produce 1 and produce 0 when false?

- But from the expected result, regardless of true/false it produce 0.

Is there any plausible answer for this?

Thank you.

Accepted Solutions
Solution
‎11-21-2017 12:26 AM
Posts: 5,624

## Re: Logic Operator?

Experiment...

```33   data _null_;
35   TARGET_PVS_ACQ = 0;
37   put _all_;
38   run;

NOTE: DATA statement used (Total process time):
real time           0.27 seconds
cpu time            0.03 seconds
```
PG

All Replies
Super User
Posts: 24,003

## Re: Logic Operator?

Anything greater than 0 is true in SAS and that will operate similar to a Boolean operator.

Solution
‎11-21-2017 12:26 AM
Posts: 5,624

## Re: Logic Operator?

Experiment...

```33   data _null_;
35   TARGET_PVS_ACQ = 0;
37   put _all_;
38   run;

NOTE: DATA statement used (Total process time):
real time           0.27 seconds
cpu time            0.03 seconds
```
PG
Super User
Posts: 6,933

## Re: Logic Operator?

Yes, you will get a Boolean result.  SAS evaluates that 0 and missing values are false, and anything else (whether positive or negative, integer or decimal) is true.

If you are getting all zeros and expected something different, check the spelling of your variable names first, and the values second.  There is no room for SAS to go wrong when evaluating true vs. false.

☑ This topic is solved.