DATA Step, Macro, Functions and more

confirm if variable exists in table 2

Reply
Occasional Contributor
Posts: 16

confirm if variable exists in table 2

I have two data sets: January and February

 

I would like to know if the value apple is in the February Table based on multiple matching

 

January Table

 

Name  Event  Snack

Paul   Picnic   Apple

Paul   Picnic   Orange

Paul   Picnic  Grape

 

February Table

Name  Event  Snack

Paul   Picnic   Apple

Paul   Picnic   Bread

Paul   Picnic  Grape

 

The result I want is

 

Summary Table:

Name  Event  Snack Validation

Paul     Picnic  Apple    Yes

Paul     Picnic  Orange  No

Paul    Picni     Grape  Yes

 

I basically want to know if the snack is in the February table as well

Super User
Posts: 5,441

Re: confirm if variable exists in table 2

[ Edited ]

Use SQL left join, and use CASE statement to see if there is a matching value from February table.

Data never sleeps
Ask a Question
Discussion stats
  • 1 reply
  • 103 views
  • 0 likes
  • 2 in conversation