I have a variable that is the age of the last child and I have to create a dummy for individuals who have children under 6 years of age, we also have some individuals who have empty values, or have had no children.
example of variable: 1 - 10 2 - 5 3 - 7 4 - 30 5 - 6 - 25 7 - 3 8-15 9 - 10 - 33
If I understood correctly, you want to create a dummy using two conditions:
dummy = 1 if:
(condition 1) the age is less than 6
(condition 2) the age is available (or different from NA)
To achieve that using Gretl you can use:
Or, if you want a more compact way: