Please am new to stata and need help in extracting wrong inputs in a dataset.
The data set contains information of households members for example age, marital status, relationship to head of household, gender, a unique reference number etc and are represented with numerical codes as indicated in the table below;
From the table, notice that the ages of some children in a households are higher than that of their parent(Head and Spouse).
I need a syntax that can extract or list all households with such abnormal ages where;
1. The age of a child or grandchild is above that of the head or spouse
2. The age difference between Spouse(mother) and child is not up to child bearing age
3. The age difference between Head(Father) and child is not up to child bearing age
.
The sample data set below are from 3 different households, 2 from same County and one from a different county
ref num of first household = Jon/home/1
ref num of second household = Mon/arm/1
ref num of third household = Can/arm/2
Thanks for your kind assistance

ref num name relationship relationship code gender Age
Jon/home/1/01 John Gore Head 1 male 56
Jon/home/1/02 Susan Gore Spouse 2 female 53
Jon/home/1/03 George Gore child 3 male 58
Jon/home/1/04 Mark Gore child 3 male 49
Jon/home/1/05 Susan Gore Grandchild 4 female 16
Jon/home/1/06 Mathew Gore child 3 male 20
Mon/arm/1/01 Mary Robert Head 1 female 30
Mon/arm/1/02 David Robert child 3 male 25
Mon/arm/1/03 Fidel Robert child 3 male 10
Can/arm/2/01 Okon David Head 1 male 45
Can/arm/2/02 Mike David child 3 male 17
Can/arm/2/03 Martha David child 3 female 47