Need help to create a by variable to merge two datasets.
One dataset is parent survey and one is a child. However they have no similar variable to link them but they are matched. I.e. participant ID for adults are even and children are odd.
For example, parent 1000 matches with child 1001, parent 1002 matches with child 1003
Make a new variable in the CHILD dataset that is one less than the child ID value and then merge on that. Or do both in one step using PROC SQL.
data parent;
input parentid name :$20.;
cards;
1000 Smith
;
data child;
input childid age ;
cards;
1001 10
;
proc sql;
create table want as select *
from parent full join child
on parent.parentid = child.childid -1
;
quit;
Are they exactly one-to-one matched ? One parent might match multiple child ? And could you post some data and desired output to explain your problem ?