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

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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