Hello! I have a data set on participants and participants' children; the data set is not one record per child. For example, the input data set includes part_ID part_hh_type child_name1, child_dob1, child_name2, child_dob2, child_name3, child_dob3 ...for 10 children. I want the output data set to look like (blue are new vars): part_ID part_hh_type child_name1, child_dob1, child_name2, child_dob2, child_name3, child_dob3... pick_childname, pick_childdob I want the two new vars pick_childname and pick_childdob to be the name and DOB for a child that the program will choose for the participant so that the overall sample ends up having a particular proportion of children in the three grade ranges pre-k, middle school, and high school. The var part_hh_type is the concatentation of the participant's number of children in the three grade ranges prek, middle, and highschool. For example, hh_type "201" means the participant has two children in prek, zero in middle school, and one child in high school. There are 26 hh_types. For each hh_type, I have vars p1, p2, and p3 which is the percent of all those hh_type participants whose "chosen" kid will be from grade ranges prek, middle, and high schoo, respectively. For exampleo, for all the participants who have 201 hh_type and p1=.5, p2=.5, p3=0, the sample should pick a kid from the pre-k age range for 50% of the participants and a kid from the middle school grade range for the other 50% of the participants; no participants with hh_Type 201 will have their hs kid chosen. Once the age range of the s_childname is chosen, the program will randomly select one of the kids in that age range to be the pick_childname and pick_childdob. I am using the call rantbl function to select the age range of the kid and then call ranuni to select the kid from that age range randomly. But how do I use this for ALL 26 hh_types? Thoughts? I appreciate the feedback! Happy holidays
... View more