You're getting the same values because you're restating your primary Boolean check.
The logic in red is unnecessary because in order to make it to that check, your Procedure Code must not be "UC". Think of it as saying:
IF it's an APPLE it's an APPLE
ELSE if it's NOT an APPLE, and it's an ORANGE, it's an ORANGE.
We don't ever need to check if it's "not an APPLE" because it will only make it to that check if its not an APPLE
Set your code up in the hierarchical order you need (check for Urgent Care first, then Physicals, and so on). That should give you the results you need.
- this works with a concatenated string of your procedure categories associated with a visit. You'll need some extra steps if you have a LIST of proc codes and want to ferret just the most relevant out of them.
- Be cautious with you short names. I looked over your categories and they seems OK, but if "UC" appeared as part of a lower-tiered (like tummy tUCk), you might flag it incorrectly as Urgent Care.
In this case
A visit can be urgent care and a physical.
Procedure code: UC, Physical, Transaction Only
If that were the case I want it to only be grouped into Urgent care and be excluded from physicals.
That’s why I felt I needed the statement that says if it’s not “UC” and it’s a “Physical” then it’s a physical.
If that is the case, the hierarchical nature of the clause will cause it to stop once it's found a match. You don't need to check if it's not something, providing you're groupin them from most to least important.
Think of it as:
Does it contain UC? If yes, it's "Urgent Care" and STOP
Otherwise, does it contain "Physical"? If so, it's "Physical" and STOP
...and so on...
If the procedure code is "UC, Physical, Transaction Only", the test for "Physical" will never be made because it stops at "Urgent Care."
You can, of course, include it if you want, but do you really want your seventh check to be:
NOT "Urgent care" AND NOT "Physicals" AND NOT "Labs and Diagnostics" AND NOT "Injections, Immunizations, and Vaccines" AND NOT "Transactions only" AND NOT "Other" AND "Misplaced"?
As Michael said, once "Urgent Care" is assigned, no more change for that cell.
"elseif" only applied the cell which was not defined thru the condition above.
if contains([Ctegory],"Urgent Care") then "UC"
ELSEIF contains([Ctegory],"Physical") then "Physicals"
elseif contains([Ctegory],"Labs") then "Labs"
elseif contains([Ctegory],"Iniject") then "Injections"
elseif contains([Ctegory],"Transaction") then "Transaction"
elseif contains([Ctegory],"Misplaced") then "Misplaced"else "Other"
But in this case, be careful that there are no same "word" in multiple procedure.
elseif_SM_9.3.twbx 20.6 KB