BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
harrylui
Obsidian | Level 7

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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...

 

 

View solution in original post

2 REPLIES 2
Jagadishkatam
Amethyst | Level 16

Could you please provide some sample data with expected output to get better response.

Thanks,
Jag
ballardw
Super User

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...

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 754 views
  • 0 likes
  • 3 in conversation