Hello,

I am attempting to reshape a dataset from wide to long, and the results are not what I expected, and need some assistance.


Background:

1. My dataset that asks each respondent to name up to 20 people (called alters) who provide specific type of services/help.

2. I then asked each respondent to state whether each pair of people named (called alters) have ever met (yes=1) or not (no=0). This will give me what are called alter_alter pairs. So for example, if respondent #1, believes alter1 has met alter2, the alter1_alter2 variable will take a value of 1 or 0, if not.

For the sake of breivity, I am providing a scratch dataset that includes 5 cases, but limits the nominations to 2, instead of 20 (please let me know if you need the full dataset containing nominations of the 5 individuals)


Here is an example of my dataset:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte id str17 alter1 str28 alter2 byte(alter1_alter1 alter1_alter2 alter2_alter1 alter2_alter2 alter3_alter1 alter3_alter2 alter4_alter1 alter4_alter2 alter5_alter1 alter5_alter2)
 3 "T"                 "Al"                           0 1 1 0 1 1 1 1 1 1
42 "1_R_Cousin"        "2_I_Wife"                     0 1 1 0 1 1 1 1 1 1
45 "A_Pastor"          "P-Elder"                      0 1 1 0 1 1 0 0 0 0
90 "T"                 "AL"                           0 1 1 0 1 1 1 1 1 1
98 "Jane_Local_Friend" "jamesbond_Acquaintance_local" 1 1 0 0 0 0 1 1 0 1
end
label values alter1_alter1 labels0
label values alter1_alter2 labels0
label def labels0 0 "No", modify
label def labels0 1 "Yes", modify
label values alter2_alter1 labels19
label def labels19 0 "No", modify
label def labels19 1 "Yes", modify
label values alter2_alter2 labels20
label def labels20 0 "No", modify
label values alter3_alter1 labels39
label def labels39 0 "No", modify
label def labels39 1 "Yes", modify
label values alter3_alter2 labels40
label def labels40 0 "No", modify
label def labels40 1 "Yes", modify
label values alter4_alter1 labels59
label def labels59 0 "No", modify
label def labels59 1 "Yes", modify
label values alter4_alter2 labels60
label def labels60 0 "No", modify
label def labels60 1 "Yes", modify
label values alter5_alter1 labels79
label def labels79 0 "No", modify
label def labels79 1 "Yes", modify
label values alter5_alter2 labels80
label def labels80 0 "No", modify
label def labels80 1 "Yes", modify



I want to reshape this to long so it looks like this extract from a different dataset.

Array

In the above example, respondent #2 nominates 3 alters: 4050 4051, 4052 & 284.
According to him, 4050 knows 4051 & 4052, while 284 knows 4052, but does not know 4050 and 4051.

I used this command to reshape the dataset:
Code:
reshape long alter1_alter alter2_alter, i(id) j(alter)
, giving me the results below:

Array


However, the results are not what I was expecting - it has both the respondent ID, and the identities of the alters, similar to nn01 & nn02 in the example provided, but then I expect one more column that indicates whether the alters have met <have met>, but it is not there.

I suspect my data may not be set up properly or my commands may be wrong, but I am not sure how to correct this. I would be very grateful for some pointers / directions.

thanks - cY