Originally posted by Clyde Schechter
View Post
I am trying to implement the code on my main final datasets (after some changes imported to the first ones). The first I run the code on a provisional file with small time spam(not in panel) and just a couple of variables it worked .It did actually matched by the longest duration.However it dropped the all variables that are shorter in my first dataset ,which contain the political indexed.That’s not desired as I will lose important information.
Please allow me to summarize what I need to do. I am having two datasets. The dataset 1 refers to the start day and end day of the actual dates of incumbents in office with some some sort of quality indexes(I provide only 2 here but there are more) while dataset2 refers to a number of macroeconomics data.(I provide only 2 series for one country here again ,but there are around 40 more of them).Consider that these data are only a small part of a panel for multiple years for multiple countries. I consider each year and country separately according to the actual duration in days of each incumbent in office for that particular year (365 or 366 days in a year depending on the leap year).
Now I need to match up only observations referring to dastet2 (macro data) to the same country for that year (1990 to 1990 etc) without mixing other counties, to the longest duration of a government in office in that year, without dropping observations in the datset1(politics) for the same year. In some years more than one governments occurred .In the dataset1 provided there are indeed two or more observations for specific years (note year 1990 in the data provided for the years with more than one observation since there was a change in government and was coded as such. The macro data in dattaset2(yearly observations) must to be matched to the longest duration of governments in a year, without dropping the politics indexes for governments, others than the longest.
Data below are for the case of Australia. In year duration was created by the code you provide. I have included only two of the indexes , but there are more.
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str15 ccode str14 oecdmember str16 eumember long(ts date) str15 country int startyear byte(startmonth startday) float(p g start) int time "Australia" "oecd member" "no eu membership" 1990 . "Australia" 1987 7 22 -4.5 -4.5 10064 11051 "Australia" "oecd member" "no eu membership" 1990 . "Australia" 1990 4 4 -14.9 -14.9 11051 11683 "Australia" "oecd member" "no eu membership" 1991 . "Australia" 1990 4 4 -14.9 -14.9 11051 11683 "Australia" "oecd member" "no eu membership" 1991 . "Australia" 1991 12 27 -14.9 -14.9 11683 12136 "Australia" "oecd member" "no eu membership" 1992 . "Australia" 1991 12 27 -14.9 -14.9 11683 12136 "Australia" "oecd member" "no eu membership" 1993 . "Australia" 1991 12 27 -14.9 -14.9 11683 12136 "Australia" "oecd member" "no eu membership" 1993 199303 "Australia" 1993 3 24 -.165 -.165 12136 13219 "Australia" "oecd member" "no eu membership" 1994 . "Australia" 1993 3 24 -.165 -.165 12136 13219 "Australia" "oecd member" "no eu membership" 1995 . "Australia" 1993 3 24 -.165 -.165 12136 13219 "Australia" "oecd member" "no eu membership" 1996 199603 "Australia" 1993 3 24 -.165 -.165 12136 13219 "Australia" "oecd member" "no eu membership" 1996 . "Australia" 1996 3 11 22.593 22.593 13219 14173 "Australia" "oecd member" "no eu membership" 1997 . "Australia" 1996 3 11 22.593 22.593 13219 14173 "Australia" "oecd member" "no eu membership" 1998 199810 "Australia" 1996 3 11 22.593 22.593 13219 14173 "Australia" "oecd member" "no eu membership" 1998 . "Australia" 1998 10 21 48.458 48.458 14173 -21220 "Australia" "oecd member" "no eu membership" 1999 . "Australia" 1998 10 21 48.458 48.458 14173 -21220 "Australia" "oecd member" "no eu membership" 2000 . "Australia" 1998 10 21 48.458 48.458 14173 -21220 "Australia" "oecd member" "no eu membership" 2001 200111 "Australia" 1998 10 21 48.458 48.458 14173 -21220 "Australia" "oecd member" "no eu membership" 2001 . "Australia" 2001 11 26 33.333 30.905804 15305 -20155 "Australia" "oecd member" "no eu membership" 2002 . "Australia" 2001 11 26 33.333 30.905804 15305 -20155 "Australia" "oecd member" "no eu membership" 2003 . "Australia" 2001 11 26 33.333 30.905804 15305 -20155 "Australia" "oecd member" "no eu membership" 2004 . "Australia" 2001 11 26 33.333 30.905804 15305 -20155 "Australia" "oecd member" "no eu membership" 2004 200410 "Australia" 2004 10 26 31.889 34.52776 16370 -19022 "Australia" "oecd member" "no eu membership" 2005 . "Australia" 2004 10 26 31.889 34.52776 16370 -19022 "Australia" "oecd member" "no eu membership" 2006 . "Australia" 2004 10 26 31.889 34.52776 16370 -19022 "Australia" "oecd member" "no eu membership" 2007 . "Australia" 2004 10 26 31.889 34.52776 16370 -19022 "Australia" "oecd member" "no eu membership" 2007 200711 "Australia" 2007 12 3 5.674 5.674 17503 -18088 "Australia" "oecd member" "no eu membership" 2008 . "Australia" 2007 12 3 5.674 5.674 17503 -18088 "Australia" "oecd member" "no eu membership" 2009 . "Australia" 2007 12 3 5.674 5.674 17503 -18088 "Australia" "oecd member" "no eu membership" 2010 . "Australia" 2007 12 3 5.674 5.674 17503 -18088 "Australia" "oecd member" "no eu membership" 2010 201008 "Australia" 2010 6 24 5.674 5.674 18437 -18006 "Australia" "oecd member" "no eu membership" 2010 . "Australia" 2010 9 14 -34.113 -34.113 18519 -16989 "Australia" "oecd member" "no eu membership" 2011 . "Australia" 2010 9 14 -34.113 -34.113 18519 -16989 "Australia" "oecd member" "no eu membership" 2012 . "Australia" 2010 9 14 -34.113 -34.113 18519 -16989 "Australia" "oecd member" "no eu membership" 2013 . "Australia" 2010 9 14 -34.113 -34.113 18519 -16989 "Australia" "oecd member" "no eu membership" 2013 201309 "Australia" 2013 6 27 -34.113 -34.113 19536 -16906 "Australia" "oecd member" "no eu membership" 2013 . "Australia" 2013 9 18 22.975 18.485498 19619 -16179 "Australia" "oecd member" "no eu membership" 2014 . "Australia" 2013 9 18 22.975 18.485498 19619 -16179 "Australia" "oecd member" "no eu membership" 2015 . "Australia" 2013 9 18 22.975 18.485498 19619 -16179 "Australia" "oecd member" "no eu membership" 2015 . "Australia" 2013 9 15 22.975 18.485498 19616 -15105 "Australia" "oecd member" "no eu membership" 2016 201607 "Australia" 2013 9 15 22.975 18.485498 19616 -15105 "Australia" "oecd member" "no eu membership" 2016 . "Australia" 2013 9 15 12.24 . 19616 -15105 "Australia" "oecd member" "no eu membership" 2017 . "Australia" 2013 9 15 12.24 . 19616 -15105 "Australia" "oecd member" "no eu membership" 2018 . "Australia" 2013 9 15 12.24 . 19616 -15105 "Australia" "oecd member" "no eu membership" 2018 . "Australia" 2013 8 24 12.24 . 19594 -14976 end format %td start
,
And here is a small sample of my macro data of one country , including a just a few of the macro series
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str48 country str3 countrycode int ts str6 timecode float(growth1 growth2) str7 gb1 str6(gb2 gb3) str7 d byte notnumeric long(gb1b gb2b gb3b d1) "Australia" "AUS" 1990 "YR1990" -.25998396 .8315406 "7,924" "0,0965" "5,648" "16.445" 1 674 26 711 152 "Australia" "AUS" 1991 "YR1991" 1.3334774 2.1083677 "8,777" "0,0864" "3,078" "21.650" 1 705 15 627 207 "Australia" "AUS" 1992 "YR1992" 3.2923484 3.4185865 "8,553" "0,1099" "1,402" "27.678" 1 697 47 467 281 "Australia" "AUS" 1993 "YR1993" 3.715279 2.6728065 "7,368" "0,1498" "1,779" "30.721" 1 656 133 517 327 "Australia" "AUS" 1994 "YR1994" 1.6375794 1.2805543 "5,84" "0,1489" "1,133" "31.782" 1 565 130 427 336 "Australia" "AUS" 1995 "YR1995" -.9972533 -.9632453 "7,754" "0,2159" "2,393" "31.234" 1 664 252 583 332 "Australia" "AUS" 1996 "YR1996" 2.770518 3.154481 "6,368" "0,1598" "2,206" "29.422" 1 600 159 562 310 "Australia" "AUS" 1997 "YR1997" 3.889898 3.9895246 "5,838" "0,1703" "1,387" "25.959" 1 564 180 465 262 "Australia" "AUS" 1998 "YR1998" 2.9572344 3.7896104 "5,414" "0,1701" "0,726" "23.754" 1 518 179 358 240 "Australia" "AUS" 1999 "YR1999" 2.561527 2.339495 "4,035" "0,1985" "1,22" "22.595" 1 368 221 440 221 "Australia" "AUS" 2000 "YR2000" .3891381 .50802076 "5,668" "0,1953" "1,461" "19.552" 1 550 216 475 187 "Australia" "AUS" 2001 "YR2001" 1.1405312 3.1164474 "5,152" "0,1514" "0,624" "17.170" 1 489 137 342 158 "Australia" "AUS" 2002 "YR2002" 2.158647 2.3763344 "5,171" "0,1963" "1,053" "15.051" 1 493 217 414 144 "Australia" "AUS" 2003 "YR2003" .3566159 .7994667 "4,268" "0,1937" "0,971" "13.221" 1 401 212 397 110 "Australia" "AUS" 2004 "YR2004" 2.7113535 2.782252 "4,361" "0,2044" "1,299" "11.948" 1 419 228 453 70 "Australia" "AUS" 2005 "YR2005" -.5891249 -.4728382 "3,639" "0,1525" "1,696" "10.891" 1 311 139 502 6 "Australia" "AUS" 2006 "YR2006" .4218182 1.0691733 "3,34" "0,1278" "1,865" "9.967" 1 275 83 526 1037 "Australia" "AUS" 2007 "YR2007" 1.1622334 1.1005231 "3,99" "0,1159" "1,916" "9.687" 1 359 58 532 1034 "Australia" "AUS" 2008 "YR2008" -.08318187 .003607297 "4,438" "0,1276" "2,003" "11.753" 1 429 82 548 69 "Australia" "AUS" 2009 "YR2009" 1.1294768 2.830966 "3,871" "0,257" "1,046" "16.654" 1 341 283 413 153 "Australia" "AUS" 2010 "YR2010" .3700751 -.070456676 "3,88" "0,2605" "2,337" "20.397" 1 342 287 577 193 "Australia" "AUS" 2011 "YR2011" 1.048757 1.0357703 "3,451" "0,1435" "2,595" "24.065" 1 288 120 598 250 "Australia" "AUS" 2012 "YR2012" 2.587376 2.995731 "3,194" "0,2031" "1,899" "27.540" 1 261 227 529 279 "Australia" "AUS" 2013 "YR2013" 1.1289984 1.2830683 "1,754" "0,295" "1,98" "30.498" 1 135 310 537 323 "Australia" "AUS" 2014 "YR2014" 1.6469382 1.930875 "2,279" "0,2662" "2,3" "34.025" 1 215 292 572 360 "Australia" "AUS" 2015 "YR2015" .3492132 .35471275 "0,711" "0,2123" "2,289" "37.690" 1 60 246 570 420 "Australia" "AUS" 2016 "YR2016" 1.0832386 1.7193124 "0,891" "0,3553" "2,255" "40.458" 1 76 342 566 479 "Australia" "AUS" 2017 "YR2017" .036598407 -.01947236 "0,414" "0,3673" "2,588" "41.066" 1 36 346 597 492 "Australia" "AUS" 2018 "YR2018" .1107098 .7712589 "0,583" "0,2131" "2,248" "41.369" 1 49 249 565 496 end label values gb1b TR10y_yield label def TR10y_yield 36 "0,414", modify label def TR10y_yield 49 "0,583", modify label def TR10y_yield 60 "0,711", modify label def TR10y_yield 76 "0,891", modify label def TR10y_yield 135 "1,754", modify label def TR10y_yield 215 "2,279", modify label def TR10y_yield 261 "3,194", modify label def TR10y_yield 275 "3,34", modify label def TR10y_yield 288 "3,451", modify label def TR10y_yield 311 "3,639", modify label def TR10y_yield 341 "3,871", modify label def TR10y_yield 342 "3,88", modify label def TR10y_yield 359 "3,99", modify label def TR10y_yield 368 "4,035", modify label def TR10y_yield 401 "4,268", modify label def TR10y_yield 419 "4,361", modify label def TR10y_yield 429 "4,438", modify label def TR10y_yield 489 "5,152", modify label def TR10y_yield 493 "5,171", modify label def TR10y_yield 518 "5,414", modify label def TR10y_yield 550 "5,668", modify label def TR10y_yield 564 "5,838", modify label def TR10y_yield 565 "5,84", modify label def TR10y_yield 600 "6,368", modify label def TR10y_yield 656 "7,368", modify label def TR10y_yield 664 "7,754", modify label def TR10y_yield 674 "7,924", modify label def TR10y_yield 697 "8,553", modify label def TR10y_yield 705 "8,777", modify label values gb2b TR10y_volatility label def TR10y_volatility 15 "0,0864", modify label def TR10y_volatility 26 "0,0965", modify label def TR10y_volatility 47 "0,1099", modify label def TR10y_volatility 58 "0,1159", modify label def TR10y_volatility 82 "0,1276", modify label def TR10y_volatility 83 "0,1278", modify label def TR10y_volatility 120 "0,1435", modify label def TR10y_volatility 130 "0,1489", modify label def TR10y_volatility 133 "0,1498", modify label def TR10y_volatility 137 "0,1514", modify label def TR10y_volatility 139 "0,1525", modify label def TR10y_volatility 159 "0,1598", modify label def TR10y_volatility 179 "0,1701", modify label def TR10y_volatility 180 "0,1703", modify label def TR10y_volatility 212 "0,1937", modify label def TR10y_volatility 216 "0,1953", modify label def TR10y_volatility 217 "0,1963", modify label def TR10y_volatility 221 "0,1985", modify label def TR10y_volatility 227 "0,2031", modify label def TR10y_volatility 228 "0,2044", modify label def TR10y_volatility 246 "0,2123", modify label def TR10y_volatility 249 "0,2131", modify label def TR10y_volatility 252 "0,2159", modify label def TR10y_volatility 283 "0,257", modify label def TR10y_volatility 287 "0,2605", modify label def TR10y_volatility 292 "0,2662", modify label def TR10y_volatility 310 "0,295", modify label def TR10y_volatility 342 "0,3553", modify label def TR10y_volatility 346 "0,3673", modify label values gb3b spreads label def spreads 342 "0,624", modify label def spreads 358 "0,726", modify label def spreads 397 "0,971", modify label def spreads 413 "1,046", modify label def spreads 414 "1,053", modify label def spreads 427 "1,133", modify label def spreads 440 "1,22", modify label def spreads 453 "1,299", modify label def spreads 465 "1,387", modify label def spreads 467 "1,402", modify label def spreads 475 "1,461", modify label def spreads 502 "1,696", modify label def spreads 517 "1,779", modify label def spreads 526 "1,865", modify label def spreads 529 "1,899", modify label def spreads 532 "1,916", modify label def spreads 537 "1,98", modify label def spreads 548 "2,003", modify label def spreads 562 "2,206", modify label def spreads 565 "2,248", modify label def spreads 566 "2,255", modify label def spreads 570 "2,289", modify label def spreads 572 "2,3", modify label def spreads 577 "2,337", modify label def spreads 583 "2,393", modify label def spreads 597 "2,588", modify label def spreads 598 "2,595", modify label def spreads 627 "3,078", modify label def spreads 711 "5,648", modify label values d1 debt label def debt 6 "10.891", modify label def debt 69 "11.753", modify label def debt 70 "11.948", modify label def debt 110 "13.221", modify label def debt 144 "15.051", modify label def debt 152 "16.445", modify label def debt 153 "16.654", modify label def debt 158 "17.170", modify label def debt 187 "19.552", modify label def debt 193 "20.397", modify label def debt 207 "21.650", modify label def debt 221 "22.595", modify label def debt 240 "23.754", modify label def debt 250 "24.065", modify label def debt 262 "25.959", modify label def debt 279 "27.540", modify label def debt 281 "27.678", modify label def debt 310 "29.422", modify label def debt 323 "30.498", modify label def debt 327 "30.721", modify label def debt 332 "31.234", modify label def debt 336 "31.782", modify label def debt 360 "34.025", modify label def debt 420 "37.690", modify label def debt 479 "40.458", modify label def debt 492 "41.066", modify label def debt 496 "41.369", modify label def debt 1034 "9.687", modify label def debt 1037 "9.967", modify
Now when I run the code the first time I obtained the following
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str14 oecdmember str16 eumember long(ts edate date) str48 country int startyear byte(startmonth startday) float(p g start) long end float(in_dur in_year_duration) str3 countrycode str6 timecode float(growth1 growth2 reexr) byte(notnumeric _merge) "oecd member" "no eu membership" 1990 . . "Australia" 1990 4 4 -14.9 -14.9 11051 11683 271 271 "AUS" "YR1990" -.25998396 .8315406 86.5236 1 3 "oecd member" "no eu membership" 1991 . . "Australia" 1990 4 4 -14.9 -14.9 11051 11683 360 360 "AUS" "YR1991" 1.3334774 2.1083677 85.14064 1 3 "oecd member" "no eu membership" 1992 . . "Australia" 1991 12 27 -14.9 -14.9 11683 12136 365 365 "AUS" "YR1992" 3.2923484 3.4185865 76.92034 1 3 "oecd member" "no eu membership" 1993 34041 199303 "Australia" 1993 3 24 -.165 -.165 12136 13219 282 282 "AUS" "YR1993" 3.715279 2.6728065 71.60689 1 3 "oecd member" "no eu membership" 1994 . . "Australia" 1993 3 24 -.165 -.165 12136 13219 364 364 "AUS" "YR1994" 1.6375794 1.2805543 75.18513 1 3 "oecd member" "no eu membership" 1995 . . "Australia" 1993 3 24 -.165 -.165 12136 13219 364 364 "AUS" "YR1995" -.9972533 -.9632453 73.50241 1 3 "oecd member" "no eu membership" 1996 . . "Australia" 1996 3 11 22.593 22.593 13219 14173 295 295 "AUS" "YR1996" 2.770518 3.154481 80.38114 1 3 "oecd member" "no eu membership" 1997 . . "Australia" 1996 3 11 22.593 22.593 13219 14173 364 364 "AUS" "YR1997" 3.889898 3.9895246 79.97285 1 3 "oecd member" "no eu membership" 1998 36071 199810 "Australia" 1996 3 11 22.593 22.593 13219 14173 293 293 "AUS" "YR1998" 2.9572344 3.7896104 73.25237 1 3 "oecd member" "no eu membership" 1999 . . "Australia" 1998 10 21 48.458 48.458 14173 15305 364 364 "AUS" "YR1999" 2.561527 2.339495 73.50773 1 3 "oecd member" "no eu membership" 2000 . . "Australia" 1998 10 21 48.458 48.458 14173 15305 365 365 "AUS" "YR2000" .3891381 .50802076 70.44536 1 3 "oecd member" "no eu membership" 2001 37205 200111 "Australia" 1998 10 21 48.458 48.458 14173 15305 329 329 "AUS" "YR2001" 1.1405312 3.1164474 67.56935 1 3 "oecd member" "no eu membership" 2002 . . "Australia" 2001 11 26 33.333 30.905804 15305 16370 364 364 "AUS" "YR2002" 2.158647 2.3763344 70.85816 1 3 "oecd member" "no eu membership" 2003 . . "Australia" 2001 11 26 33.333 30.905804 15305 16370 364 364 "AUS" "YR2003" .3566159 .7994667 79.37099 1 3 "oecd member" "no eu membership" 2004 . . "Australia" 2001 11 26 33.333 30.905804 15305 16370 299 299 "AUS" "YR2004" 2.7113535 2.782252 85.42181 1 3 "oecd member" "no eu membership" 2005 . . "Australia" 2004 10 26 31.889 34.52776 16370 17503 364 364 "AUS" "YR2005" -.5891249 -.4728382 87.96766 1 3 "oecd member" "no eu membership" 2006 . . "Australia" 2004 10 26 31.889 34.52776 16370 17503 364 364 "AUS" "YR2006" .4218182 1.0691733 87.24076 1 3 "oecd member" "no eu membership" 2007 . . "Australia" 2004 10 26 31.889 34.52776 16370 17503 336 336 "AUS" "YR2007" 1.1622334 1.1005231 92.33583 1 3 "oecd member" "no eu membership" 2008 . . "Australia" 2007 12 3 5.674 5.674 17503 18437 365 365 "AUS" "YR2008" -.08318187 .003607297 90.3757 1 3 "oecd member" "no eu membership" 2009 . . "Australia" 2007 12 3 5.674 5.674 17503 18437 364 364 "AUS" "YR2009" 1.1294768 2.830966 87.59603 1 3 "oecd member" "no eu membership" 2010 . . "Australia" 2007 12 3 5.674 5.674 17503 18437 174 174 "AUS" "YR2010" .3700751 -.070456676 100 1 3 "oecd member" "no eu membership" 2011 . . "Australia" 2010 9 14 -34.113 -34.113 18519 19536 364 364 "AUS" "YR2011" 1.048757 1.0357703 106.966 1 3 "oecd member" "no eu membership" 2012 . . "Australia" 2010 9 14 -34.113 -34.113 18519 19536 365 365 "AUS" "YR2012" 2.587376 2.995731 109.022 1 3 "oecd member" "no eu membership" 2013 . . "Australia" 2010 9 14 -34.113 -34.113 18519 19536 177 177 "AUS" "YR2013" 1.1289984 1.2830683 103.4509 1 3 "oecd member" "no eu membership" 2014 . . "Australia" 2013 9 18 22.975 18.485498 19619 20346 364 364 "AUS" "YR2014" 1.6469382 1.930875 98.32265 1 3 "oecd member" "no eu membership" 2015 . . "Australia" 2013 9 15 22.975 18.485498 19616 21420 364 364 "AUS" "YR2015" .3492132 .35471275 89.83605 1 3 "oecd member" "no eu membership" 2016 . . "Australia" 2013 9 15 12.24 . 19616 21420 365 365 "AUS" "YR2016" 1.0832386 1.7193124 90.90352 1 3 "oecd member" "no eu membership" 2017 . . "Australia" 2013 9 15 12.24 . 19616 21420 364 364 "AUS" "YR2017" .036598407 -.01947236 93.67592 1 3 "oecd member" "no eu membership" 2018 . . "Australia" 2013 8 24 12.24 . 19594 21549 364 364 "AUS" "YR2018" .1107098 .7712589 89.92953 1 3 end format %td start format %td end label values _merge _merge label def _merge 3 "matched (3)", modify
We can easily see that indeed has merged to the longest in year duration of governments duration but has dropped all the observation for the political indexes in the first dataset when more than one governments occurred. This is not desired. They should stay there without being associated to the variables of the second dataset. In order to help better understand I paste the form the dataset should have created in excel. The variables and the values of the data might not be the same with the datasets but does not matter. This is just for example purposes. See the cases for 1993 and 1996
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str9 ccode str11 oecdmember str16 eumember int ts long(edate date) str8(start end) str9 country int startyear byte(startmonth startday) float(p g) str9 countryname str3 countrycode int time str6 timecode float(growth growth2b) "Australia" "oecd member" "no eu membership" 1990 . . "22/7/87" "4/4/90" "Australia" 1987 7 22 -4.5 -4.5 "" "" . "" . . "Australia" "oecd member" "no eu membership" 1990 . . "4/4/90" "27/12/91" "Australia" 1990 4 4 -14.9 -14.9 "Australia" "AUS" 1990 "YR1990" -.259984 .8315406 "Australia" "oecd member" "no eu membership" 1991 . . "4/4/90" "27/12/91" "Australia" 1990 4 4 -14.9 -14.9 "" "" . "" . . "Australia" "oecd member" "no eu membership" 1991 . . "27/12/91" "24/3/93" "Australia" 1991 12 27 -14.9 -14.9 "Australia" "AUS" 1991 "YR1991" 1.3334774 2.1083677 "Australia" "oecd member" "no eu membership" 1992 . . "27/12/91" "24/3/93" "Australia" 1991 12 27 -14.9 -14.9 "Australia" "AUS" 1992 "YR1992" 3.2923484 3.4185865 "Australia" "oecd member" "no eu membership" 1993 . . "27/12/91" "24/3/93" "Australia" 1991 12 27 -14.9 -14.9 "" "" . "" . . "Australia" "oecd member" "no eu membership" 1993 34041 199303 "24/3/93" "11/3/96" "Australia" 1993 3 24 -.165 -.165 "Australia" "AUS" 1993 "YR1993" 3.715279 2.6728065 "Australia" "oecd member" "no eu membership" 1994 . . "24/3/93" "11/3/96" "Australia" 1993 3 24 -.165 -.165 "Australia" "AUS" 1994 "YR1994" 1.6375794 1.2805543 "Australia" "oecd member" "no eu membership" 1995 . . "24/3/93" "11/3/96" "Australia" 1993 3 24 -.165 -.165 "Australia" "AUS" 1995 "YR1995" -.9972533 -.9632453 "Australia" "oecd member" "no eu membership" 1996 35126 199603 "24/3/93" "11/3/96" "Australia" 1993 3 24 -.165 -.165 "" "" . "" . . "Australia" "oecd member" "no eu membership" 1996 . . "11/3/96" "21/10/98" "Australia" 1996 3 11 22.593 22.593 "Australia" "AUS" 1996 "YR1996" 2.770518 3.154481 "Australia" "oecd member" "no eu membership" 1997 . . "11/3/96" "21/10/98" "Australia" 1996 3 11 22.593 22.593 "Australia" "AUS" 1997 "YR1997" 3.889898 3.9895246 "Australia" "oecd member" "no eu membership" 1998 36071 199810 "11/3/96" "21/10/98" "Australia" 1996 3 11 22.593 22.593 "Australia" "AUS" 1998 "YR1998" 2.9572344 3.7896104 "Australia" "oecd member" "no eu membership" 1998 . . "21/10/98" "26/11/01" "Australia" 1998 10 21 48.458 48.458 "" "" . "" . . "Australia" "oecd member" "no eu membership" 1999 . . "21/10/98" "26/11/01" "Australia" 1998 10 21 48.458 48.458 "Australia" "AUS" 1999 "YR1999" 2.561527 2.339495 "Australia" "oecd member" "no eu membership" 2000 . . "21/10/98" "26/11/01" "Australia" 1998 10 21 48.458 48.458 "Australia" "AUS" 2000 "YR2000" .3891381 .50802076 "Australia" "oecd member" "no eu membership" 2001 37205 200111 "21/10/98" "26/11/01" "Australia" 1998 10 21 48.458 48.458 "Australia" "AUS" 2001 "YR2001" 1.1405312 3.1164474 "Australia" "oecd member" "no eu membership" 2001 . . "26/11/01" "26/10/04" "Australia" 2001 11 26 33.333 30.905804 "" "" . "" . . "Australia" "oecd member" "no eu membership" 2002 . . "26/11/01" "26/10/04" "Australia" 2001 11 26 33.333 30.905804 "Australia" "AUS" 2002 "YR2002" 2.158647 2.3763344 "Australia" "oecd member" "no eu membership" 2003 . . "26/11/01" "26/10/04" "Australia" 2001 11 26 33.333 30.905804 "Australia" "AUS" 2003 "YR2003" .3566159 .7994667 "Australia" "oecd member" "no eu membership" 2004 . . "26/11/01" "26/10/04" "Australia" 2001 11 26 33.333 30.905804 "Australia" "AUS" 2004 "YR2004" 2.7113535 2.782252 "Australia" "oecd member" "no eu membership" 2004 38269 200410 "26/10/04" "3/12/07" "Australia" 2004 10 26 31.889 34.52776 "" "" . "" . . "Australia" "oecd member" "no eu membership" 2005 . . "26/10/04" "3/12/07" "Australia" 2004 10 26 31.889 34.52776 "Australia" "AUS" 2005 "YR2005" -.5891249 -.4728382 "Australia" "oecd member" "no eu membership" 2006 . . "26/10/04" "3/12/07" "Australia" 2004 10 26 31.889 34.52776 "Australia" "AUS" 2006 "YR2006" .4218182 1.0691733 end
Please note also in the second dataset there are some data coded as long. I tried to convert them in real numbers, first by using both the destring and decode commands and then the program you wrote above,
Code:
foreach v of varlist myvars1 myvar2 myvar3 myvar4 { decode `v', gen(_`v') drop `v' rename _`v' `v' destring `v', dpcomma replace } isid country ts
I would appreciate any further help you can provide. I am already indebted to you
Regards,
Mario Ferri
Comment