good day,
I am do some checkings on my data base.
Name
row1
row2
if row1_name =row2_name then checking="Y"
and the result is "Y"
how can i avoid this?
thanks in advance
Regards,
Harry
I am guessing without actual data but if you want some assigned only when the values are not missing then you have to test for that before the assignment. Blank=blank (or missing = missing) is true.
if not missing(row1_name) and not missing(row2_name) and row1_name =row2_name then checking="Y";
Missing is one of the few functions that works with both character or numeric values. A character value of blank would be considered "missing".
For your specific issue possibly only need to check one of the values for missing but it is better practice to be explicit about when you want something done because 6 months later when you come back to modify the code because something else needs to be added you may not remember that you may want to have a separate behavior for when only one is missing...
Could you please provide some sample data with expected output to get better response.
I am guessing without actual data but if you want some assigned only when the values are not missing then you have to test for that before the assignment. Blank=blank (or missing = missing) is true.
if not missing(row1_name) and not missing(row2_name) and row1_name =row2_name then checking="Y";
Missing is one of the few functions that works with both character or numeric values. A character value of blank would be considered "missing".
For your specific issue possibly only need to check one of the values for missing but it is better practice to be explicit about when you want something done because 6 months later when you come back to modify the code because something else needs to be added you may not remember that you may want to have a separate behavior for when only one is missing...
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.