@JC411911 wrote:
Hello @jimbarbour , Thanks for your time.I did try the below code and it did work perfect. It does seem to simply the code as all left over results are sent to highcol. The misschol also had the correct results, but to your point I think from here on out I will utilize missing() for this. Dumb question but can I use the missing function for character values as well or is this a numeric function only?
if cholesterol = . then
output work.misschol;
else if cholesterol lt 200 then
output work.lowchol;
else
output work.highchol;
As mentioned by @Tom, the MISSING function works on both Character or Numeric data. It's a great function. 🙂
So several I think good points here:
Missing values are considered lower than even large negative numbers. In IF statements, Check for Missing first.
MISSING() works for both character or numeric
MISSING() for numeric is superior because it will check for all valid representations of Missing, not just a period.
The last ELSE in a series of IF THEN ELSE statements should generally not have another condition. In other words, the last ELSE should be a default which will catch anything not covered in the conditions of the IF's.
When comparing the results of two different conditionals, (e.g. IF vs IF, IF vs. WHERE), check the conditions in the same order. "Apples to apples" makes for a valid comparison. "Apples to oranges" does not.
Jim
... View more