Hello,
I am new to SAS and to SAS Data Step. I want to know how I can update a Variable V1 in a Data Set A with the Value "Yes" whenever there is a match with Data Set B having a common Variable V2 between the 2 data sets?
I read about Merge and Update, but I don't see how it can benefit my specific query as I am looking to enter a Constant String value in a Variable when ever there is a match in Values between 2 tables.
You're looking in the right direction. You need to add to what you have seen so far by adding IN= variables when you MERGE. For example:
data want;
merge a (in=from_a) b (in=from_b);
by V2;
if from_a;
if from_b then v1='Yes';
run;
This example assumes that both data sets are already in sortedf order by V2.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.