Dear Statlisters,
I need your help to solve this problem. I have been trying to look for solutions on the already shared/discussed threads on the same topic on statlist but could not find any relevant solution.
Question:
I need to convert this data (long) to wide. Where I need rp_entity_id; entity_type; all rows in data_type to column; range_start; range_end.
Challenge:
The problem is rp_entity_id; data_values; range_start and range_end are not unique. Hence I get an error (r9) when I use reshape wide command.
Sample data is as follows:
Looking Forward to your advice.
I need your help to solve this problem. I have been trying to look for solutions on the already shared/discussed threads on the same topic on statlist but could not find any relevant solution.
Question:
I need to convert this data (long) to wide. Where I need rp_entity_id; entity_type; all rows in data_type to column; range_start; range_end.
Challenge:
The problem is rp_entity_id; data_values; range_start and range_end are not unique. Hence I get an error (r9) when I use reshape wide command.
Sample data is as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str6 rp_entity_id str4 entity_type str11 data_type str94 data_value str10(range_start range_end) "00039D" "COMP" "COUNTRY" "CA" "1/1/2010" "22/8/2012" "00039D" "COMP" "ENTITY_NAME" "Trilateral Energy Ltd." "1/1/2010" "22/8/2012" "00039D" "COMP" "NAME" "TRILATERAL ENERGY LTD." "1/1/2010" "22/8/2012" "0005DF" "COMP" "COMPANY" "JE/PRD" "24/5/2018" "" "0005DF" "COMP" "COMPANY" "JE/PRD.LN" "19/12/2017" "" "0005DF" "COMP" "COUNTRY" "JE" "19/12/2017" "" "0005DF" "COMP" "CUSIP" "G72090106" "24/5/2018" "" "0005DF" "COMP" "ENTITY_NAME" "Predator Oil & Gas Holding PLC" "1/1/2000" "" "0005DF" "COMP" "ISIN" "JE00BFZ1D698" "24/5/2018" "" "0005DF" "COMP" "LISTING" "XLON:PRD" "24/5/2018" "" "0005DF" "COMP" "MIC" "XLON" "24/5/2018" "" "0005DF" "COMP" "NAME" "PREDATOR OIL & GAS HOLDING PLC" "19/12/2017" "" "0005DF" "COMP" "SEDOL" "BFZ1D69" "24/5/2018" "" "0005DF" "COMP" "TICKER" "PRD" "24/5/2018" "" "0005DF" "COMP" "TICKER" "PRD.LN" "1/1/2000" "" "00061D" "COMP" "COUNTRY" "RS" "1/1/2002" "" "00061D" "COMP" "ENTITY_NAME" "Zdravo DOO" "1/1/2000" "" "00061D" "COMP" "NAME" "ZDRAVO DOO" "1/1/2002" "" "00067A" "COMP" "COMPANY" "US/HUM" "1/1/2000" "" "00067A" "COMP" "COUNTRY" "US" "1/1/2000" "" end