Help using Base SAS procedures

How to make a group-id number

Posts: 0

How to make a group-id number


I am looking for help to be able to create a group-id number
I have the following information for the persons in my dataset:

- Person identification number
- Father identification number (i.e. ID-number for the father of each of the persons in my dataset)
- Mother Identification number (i.e. (i.e. ID-number for the mother of each of the persons in my dataset)

I would like to make a group-id for each sibling-pair in my dataset (for both half and full siblings). Some of the persons in my dataset will have more than one sibling, but I wish all of the siblings to be included as pairs.

Does anyone know how to do this?

Thank you!
Respected Advisor
Posts: 3,887

Re: How to make a group-id number


Does a sibling have both parents in common or is one parent (i.e. same father) enough?

If it's both parents then creating a group id is easy: Just sort by father_id and mother_id and generate a group_id for all records sharing the same mother_id (using first and last and a retained variable group_id).

If "half" siblings are also siblings then the story becomes more complicated and a simple group_id is no more possible (as A can be sibling of B, and B sibling of C, but A and C are not related).

With "half" siblings you'll end up with a network and one would have to create an association table. The way you would create a datamart (having all information in one table) depends then on what you want to do with the data ("multiple records" for one child or a "relationship array").

Posts: 0

Re: How to make a group-id number


Thank you for your response! Very helpful to know what the next step is.
I will start wokring on the association table.
Respected Advisor
Posts: 3,887

Re: How to make a group-id number

Hi Grethe

The association table is for storing and maintaining the data. For reporting purposes you might be better off to create a data mart shaped to the kind of reports you intend to create.

If - and only if - you don't have too many data then the reporting datamart(s) could also be implemented as views which query the underlying tables using an association table.

The data model with the association table could look as follows:

PERSON{PersonID,...variables containing attributs of this person}
RELATIONSHIP{PersonID,RelatedPersonID,RelationshipID,...additional attributes}

PERSON has a 1 to zero or many relation to RELATIONSHIP

RELATIONSHIP_TYPE is only a lookup table for RELATIONSHIP with a few records and values for RelationshipDescription like "Father", "Mother", "Sibling", "Aunt".... and so on.

Patrick Message was edited by: Patrick
Ask a Question
Discussion stats
  • 3 replies
  • 2 in conversation