I'm using SAS Enterprise Guide 7.1 and i'm having a problem with something that seems fairly basic. I'll simplify the problem but fundamentally I have one computed column (Computed_column1) that uses a CASE/WHEN statement e.g.
CASE
WHEN x > y THEN "TRUE"
ELSE "FALSE"
END
I'd like to reference the first computed column in a second computed column (Computed_column2) but instead of referring to the computed column name the advanced expression tab in the query builder pulls through all of the contents from the first computed column. Therefore if i need to change the first column i'll have to change the second one also.
So my second computed column looks something like this:
CASE
WHEN (CASE WHEN x > y THEN "TRUE" ELSE "FALSE" END) > z THEN "TRUE"
ELSE "FALSE"
END
When i'd like it to be some type of dynamic reference like:
CASE
WHEN Computed_column1 > z THEN "TRUE"
ELSE "FALSE"
END
This way if the first computed column changes the second will also. Is this not possible?
Cheers in advance.
You can read more about calculated variables here (paragraph name "THE CALCULATED OPTION ON THE SELECT"). In your case you should write:
CASE
WHEN CALCULATED Computed_column1 > z THEN "TRUE"
ELSE "FALSE"
END
This works almost as exactly as you've imagined it. Just use calculated
rather than computed
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With