Consider another sample data called reshape2. Sometimes a variable called id does not serve as unique identifier – and that’s one of the reasons we need to be careful when reshaping data. Reshape from wide to long: complex unique identifier * we simply put inc and ue as stubs, then put id and year as i and j as we did in the previous example. In this case, 1) the stub should be inc, which is the variable to be converted from wide to long, 2) i is the id variable, which is the unique identifier of observations in wide form, and 3) j is the year variable that I am going to create – it tells Stata that suffix of inc (i.e., 80, 81, 82) should be put in the variable called year. The syntax should look like this in general: reshape long stub, i(i) j(j) * let's make the first example simpler by keeping id, sex and the inc variables
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |