Dear Statalist Forum,
I want to expand observations by using the expand command; I want to make 5 duplicates, so that I have 6 observations instead of one:
expand 5, gen(newobs)
So far, so clear. Now I want to generate a new variable that assigns a value between 60 and 65 to each of the duplicates.
Example:
Sex birthyear newobs newvar
male 1937 0 60
male 1937 1 61
male 1937 1 62
male 1937 1 63
male 1937 1 64
male 1937 1 65
I have no idea how to do this. Any help is greatly appreciated.
Cheers,
Barbara
I want to expand observations by using the expand command; I want to make 5 duplicates, so that I have 6 observations instead of one:
expand 5, gen(newobs)
So far, so clear. Now I want to generate a new variable that assigns a value between 60 and 65 to each of the duplicates.
Example:
Sex birthyear newobs newvar
male 1937 0 60
male 1937 1 61
male 1937 1 62
male 1937 1 63
male 1937 1 64
male 1937 1 65
I have no idea how to do this. Any help is greatly appreciated.
Cheers,
Barbara
Comment