I confront a dataset which has years in wide format and my x variables in long format. To become clearer here is a sample:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str8 country str4 c_code str32 Series_Name str17 Series_Code str18(YR1992 YR1993 YR1994 YR1995 YR1996) "country1" "CNT1" "Patent applications, residents" "IP.PAT.RESD" "1400" "1318" "1261" "1266" "1218" "country1" "CNT1" "GDP per capita growth (annual %)" "NY.GDP.PCAP.KD.ZG" "4.099279323183325" "1.385695304686465" "4.681958496395652" "3.796066932292888" "2.594566311316314" "country1" "CNT1" "GNI per capita growth (annual %)" "NY.GNP.PCAP.KD.ZG" "3.858303463125125" "1.381346449568284" "4.556853943082984" "4.237543571605798" "2.16534040388261" "country1" "CNT1" "Population growth (annual %)" "SP.POP.GROW" "3.45546689873163" "2.6580917791605" "2.58926284874797" "2.66828695661805" "2.61650594252757" "country2" "CNT2" "Patent applications, residents" "IP.PAT.RESD" "7568" "7493" "7872" ".." "6997" "country2" "CNT2" "GDP per capita growth (annual %)" "NY.GDP.PCAP.KD.ZG" ".7658076159323457" "-.9134017160057795" "2.130215482662706" "2.885202330876638" "1.257907469118265" "country2" "CNT2" "GNI per capita growth (annual %)" "NY.GNP.PCAP.KD.ZG" ".6113365996124998" "-.6734534226950046" "1.972249507385186" "3.2314477354942" "1.511467402218656" "country2" "CNT2" "Population growth (annual %)" "SP.POP.GROW" ".0679244330808808" ".061135853002924" ".0203720739457194" ".0015885623091739" ".0281044080072756" "country3" "CNT3" "Patent applications, residents" "IP.PAT.RESD" "6" "9" "6" "7" "2" "country3" "CNT3" "GDP per capita growth (annual %)" "NY.GDP.PCAP.KD.ZG" "1.059251218389278" "8.387462951355374" ".4043914941706817" "1.366123807116608" "-1.070996724677158" "country3" "CNT3" "GNI per capita growth (annual %)" "NY.GNP.PCAP.KD.ZG" ".." ".." ".." ".." ".." "country3" "CNT3" "Population growth (annual %)" "SP.POP.GROW" ".882986989297851" ".945478147783712" ".970332280462307" ".9658941789551651" ".9629772462219111" "country4" "CNT4" "Patent applications, residents" "IP.PAT.RESD" "337498" "331774" "319261" "333770" "339045" "country4" "CNT4" "GDP per capita growth (annual %)" "NY.GDP.PCAP.KD.ZG" ".5980377414292803" "-.7631581606960367" ".6495827707906301" "2.350629363992994" "2.839291737515509" "country4" "CNT4" "GNI per capita growth (annual %)" "NY.GNP.PCAP.KD.ZG" ".7526720510240779" "-.7368424087351571" ".5651020838581786" "2.367905056031418" "3.169965050806439" "country4" "CNT4" "Population growth (annual %)" "SP.POP.GROW" ".248237080928634" ".246819412580702" ".340685788662686" ".381789601137122" ".253188880298405" end
Does anyone has an idea about how could be done?
Thanks in advance.
0 Response to Reshape panel data with long and wide variables
Post a Comment