From Stata’s command line generate the data set below
| V1 | V2 | V3 |
| 1 | 3 | 5 |
| 2 | 16 | 3 |
| 5 | 12 | 2 |
a) From Stata’s command line generate a new variable named v4
with values 1
in row 1, 2 in row 2, and 1 in row 3.
b) Rename the variable v4 as sex and definene value labels for
sex as
1=male, 2=female
c) Generate a new index variable named id that assigns a unique
number
to each of the current observations (hint: use the
generatecommand in
conjunction with the _n system variable).
d) Rename the variables v1, v2, and v3 as time1, time2, and
time3
(e) Use the reshape command to convert the data set into long
form by year.
(f) Generate a new variable named dthat is equal to the
squared diference between the variable time at each
occasion and the average of time for each subject(hint:
you’ll
need to use the egen command).
(g) Drop the observation corresponding to the third year for
id=2





