How to create one variable to show my merging results

Reply
Frequent Contributor
Posts: 122

How to create one variable to show my merging results

Hi, I use proc sql procedure to merge two dataset A and B. I full join these two datasets, but would like to know which observation belongs to which. I want to a new variable to show this information (like variable with value 1 for only from A, 2 for only from B, or 3 for from both A & B).

Thank you.

Super Contributor
Posts: 644

Re: How to create one variable to show my merging results

Assuming var1 is in A and var2 is in B

case

     when (A.var1 is not null) then 1

     when (B.var2 is not null) then 2

     else 3

end               as     source

Richard

Ask a Question
Discussion stats
  • 1 reply
  • 136 views
  • 0 likes
  • 2 in conversation