Hi
I have a data set that includes the mother and child information in one row - they are combined using their shared family ID, but what just realized that if there are multiple children with the same family ID only one match with the mother happens.
How do I duplicate the mother information to merge with the 2nd or 3rd etc. child information. and maintain one whole data set?
thank you
We can't provide a solution to your problem until you provide some sample mother and child data and details of what you would like it changed to.
How was the child and family information merged/combined? Sounds like something went wrong in that step, so that step should be fixed.
Can you show the code or logic used?
Or the data structure. Fake data is fine but ensure the output expected matches with the input shown, ie provide a reproducible example.
first I combined the demographics data with the screening data
DATA have;
MERGE screen
dem;
BY ID_Person;
RUN;
then separated the child and mother data
data adult;
set have;
if Adult = 'Adult' then output;
run;
data adult2;
set adult;
if CD_Gender = 'Female' then output;
run;
data child;
set have;
if child = 'Child' then output;
run;
then I did some editing to some other variables like adding "A_" before all the variables associated with "Adult" so that when I merged them it wouldn't overwrite it - except for the variable "ID_Family"
next I sort it by the ID_family that both of the data sets have
proc sort data = child2;
by ID_family;
run;
proc sort data = adult;
by ID_family;
run;
data want;
Merge child
adult;
by ID_family;
run;
sorry that is wrong I meant to say just "child" I think it was a typo error that is the code i used i can't show the rename section as it is a HIPPA problem
HIPAA doesn't apply to variable names, it applies to patient data and you can make fake data. Unfortunately with what you've shown I cannot assist any further.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.