Hi,
I have two datasets with different variables. But both datasets have a variable "sequence number" to represent observations. I want to know how many observations are different from each other (or how many observations are not in dataset 1 but in dataset 2). I also want to create a new dataset with variables in dataset 2.
Dataset 1:
seqn variable1 variable 2
1 3 2
3 4 2
......
dataset 2:
seqn variable3 variable 4
1 1 4
2 2 3
3 2 3
......
dataset I want:
seqn variable3 variable 4
2 2 3
......
Thank you!
data want;
merge dataset1(in=in1) dataset2(in=in2);
by seqn;
if in2 and not in1;
run;
data want;
merge dataset1(in=in1) dataset2(in=in2);
by seqn;
if in2 and not in1;
run;
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.