Dear Statalist Forum,
I have a problem with the following reshape command:
I get the following error:
Now comes the interesting point.
Using
Tells me that the id does not give unique observations.
However, I find that the ins_pos_id does cause a difference between observation one and two
if I look at the data.
In thefirst observation ins_pos_id is equal to 1 and in the second observation ins_pos_id the value is equal to 6.
Ins_pos_id is codes different investment instruments.
This is the Data.
What is going wrong?
I am using Stata 14 and I have Stata 16 available.
Thank you very much
and kind regards
Alexander Marx
I have a problem with the following reshape command:
Code:
reshape wide value, i(country cpcountry cpsector period) j(ins_pos_id)
Code:
values of variable ins_pos_id not unique within country cpcountry cpsector period Your data are currently long. You are performing a reshape wide. You specified i(country cpcountry cpsector period) and j(ins_pos_id). There are observations within i(country cpcountry cpsector period) with the same value of j(ins_pos_id). In the long data, variables i() and j() together must uniquely identify the observations.
Using
Code:
egen id = group(country cpcountry cpsector period ins_pos_id) isid id
However, I find that the ins_pos_id does cause a difference between observation one and two
if I look at the data.
In thefirst observation ins_pos_id is equal to 1 and in the second observation ins_pos_id the value is equal to 6.
Ins_pos_id is codes different investment instruments.
This is the Data.
Code:
input float id str27 country str51 cpcountry str34 cpsector str7 period float(ins_pos_id value) 1 "5A: All reporting countries" "1C: International organisations" "A: All sectors" "1978-Q1" 1 -72.673 2 "5A: All reporting countries" "1C: International organisations" "A: All sectors" "1978-Q1" 6 -72.673 3 "5A: All reporting countries" "1C: International organisations" "A: All sectors" "1978-Q2" 1 152.314 4 "5A: All reporting countries" "1C: International organisations" "A: All sectors" "1978-Q2" 6 152.314
What is going wrong?
I am using Stata 14 and I have Stata 16 available.
Thank you very much
and kind regards
Alexander Marx
Comment