04-19-2017 10:05 AM
I have two datasets called A and B- group B is a subset of group A (everyone in group B should be in group A), and group B is the people who had an event/outcome, and ultimately I'd like to have a master dataset w. people who had an event and who had not had an event. Then I would like to have a new variable (e.g. outcome) and assign values so that everyone from B should have 1 and the rest of the people have 0. What SAS procedures should I use? Any suggestion/examples would be greatly appreciated.
04-19-2017 10:12 AM
This is data management, combing datasets, which is handled either in a data step or proc SQL.
set A B indsname=source;
source_dsn = source;
Relevant reference, there's many examples here:
04-19-2017 10:15 AM
Similar questions are asked at least daily, please use the search functionality.
04-19-2017 10:22 AM
If B is a subset of A, you could use this approach:
proc sort data=a;
proc sort data=b;
merge a b (in=b);
You haven't told us the names of your variables, so I'm using ID here as the common variable to match on.