Hi
I have two data sets that come from the same code, but run at two different points in time. One of the variables, Jur2006, has more 2000 observations marked as 'true' in the prior run than the current run. I would expect a few hundred different, but 2000 is too many.
To see what the difference is relative to the observations, I would like to compare the two data sets and identify the observations marked as 'true' in the prior run, but no longer marked as 'true' in the current run and output those observations in a 3rd data set. Is there a way to do this with PROC COMPARE or using a simple merge (which I am trying)?
Paul
Sounds like a job for Proc SQL.
Proc Sql;
Create table mismatch as
select a.*
from ( select * from FirstDataSet where Jur2006='True') as a
natural join
(select * from SecondDataSet where Jur2006='False') as a
where a.Jur2006 ne b.Jur2006;
quit;
You'll need to change the names of the datasets and how the variable is indicated to be true or false. The output dataset barring ill fortune should have the records from the first run where the value changed.
WARNING: if enough values are repeated such that what might be considered a combination of identification variables have the same pattern for multiple records you're going to have some fun.
Sounds like a job for Proc SQL.
Proc Sql;
Create table mismatch as
select a.*
from ( select * from FirstDataSet where Jur2006='True') as a
natural join
(select * from SecondDataSet where Jur2006='False') as a
where a.Jur2006 ne b.Jur2006;
quit;
You'll need to change the names of the datasets and how the variable is indicated to be true or false. The output dataset barring ill fortune should have the records from the first run where the value changed.
WARNING: if enough values are repeated such that what might be considered a combination of identification variables have the same pattern for multiple records you're going to have some fun.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.