Question: 3. Generate the dataset below using STATA's command line: varl 2 4 10 var2 6 32 24 var3 10 6 4 Hint: You might

 


3. Generate the dataset below using STATA's command line: varl 2 4

3. Generate the dataset below using STATA's command line: varl 2 4 10 var2 6 32 24 var3 10 6 4 Hint: You might want to use the help function to look at at the input command (a) Using STATA's command line, create a variable named var4 with values: 1 in row 1, 2 in row 2, and 1 in row 3. (b) Rename the variable var4 to sex, and use the label command to define value labels male for value 1, and female for value 2. (c) Use the generate command with the _n system variable to create a variable called idx that assigns a unique number to each row (d) Rename variables var1, var2, and var3 as time1, time2, and time3 (e) Use the reshape command to convert the dataset into long form by year (f) Use the egen command to generate a new variable named d that is equal to the squared difference between the variable time at each occasion and the average of time for each subject (g) Drop the observation/row corresponding to the third year for id=2

Step by Step Solution

3.48 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Using STATAs command line create a variable named var4 with values 1 in row 1 2 in row 2 and 1 in ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Economics Questions!