Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: filling missing rows


From   [email protected]
To   [email protected]
Subject   st: filling missing rows
Date   Tue, 13 Nov 2007 20:04:56 +0100

Dear All,
My database includes the following variables:
- Country-pair
- Product lines
- Year
- Bilateral Trade flows;
- GDPs for exporter and importer countries;
- Preference tariffs;


The database treats as missing the observations where trade flows are zero. I need to recover such zero values, and at the same time I have to preserve the value of the other variables. Trying to explain with an example, suppose having the following country pair : EU-ALBANIA and EU-BARBADOS and suppose the total number of agricultural product lines is 6 (actually they are hundreds, I�m just simplifying to be clear). Now, in 2000 no lines is missing, by contrast in 2001 some product lines are missing as follows:

Country pair Lines Year Trade flows GDP_IMP GDP_EXP Preference tariffs
EU-ALBANIA 1 2000 50 100 85 2
EU-ALBANIA 2 2000 60 100 85 3
EU-ALBANIA 3 2000 100 100 85 2
EU-ALBANIA 4 2000 90 100 85 1
EU-ALBANIA 5 2000 60 100 85 1
EU-ALBANIA 6 2000 40 100 85 7
EU-BARBADOS 1 2000 60 100 90 3
EU-BARBADOS 2 2000 100 100 90 2
EU-BARBADOS 3 2000 90 100 90 1
EU-BARBADOS 4 2000 60 100 90 1
EU-BARBADOS 5 2000 40 100 90 7
EU-BARBADOS 6 2000 40 100 90 6
EU-ALBANIA 1 2001 50 110 87 2
EU-ALBANIA 2 2001 90 110 87 1
EU-ALBANIA 4 2001 20 110 87 5
EU-BARBADOS 1 2001 50 110 92 2
EU-BARBADOS 6 2001 60 110 92 3

Instead I should have the following complete data for 2001

Country pair Lines Year Trade flows GDP_IMP GDP_EXP Preferencetariffs
EU-ALBANIA 1 2001 50 110 87 2
EU-ALBANIA 2 2001 0 110 87 3
EU-ALBANIA 3 2001 0 110 87 2
EU-ALBANIA 4 2001 90 110 87 1
EU-ALBANIA 5 2001 0 110 87 1
EU-ALBANIA 6 2001 40 110 87 7
EU-BARBADOS 1 2001 60 110 92 3
EU-BARBADOS 2 2001 0 110 92 2
EU-BARBADOS 3 2001 90 110 92 1
EU-BARBADOS 4 2001 0 110 92 1
EU-BARBADOS 5 2001 0 110 92 7
EU-BARBADOS 6 2001 0 110 92 5.5

I have added extra rows so as to obtain 6 lines each year for each pair of countries. Please notice that I need only the trade flows to be zero, whilst the other variables have to maintain the same value they have in that particular year. Moreover, I need to impute the right line codes to the new created rows. This is a difficult task, as there are so many different combinations of missing lines in different years (the total number of lines is almost 500...)
I gave a look to the command FILL , but it does not seem to solve my case. Do you know another command or way, which enables to get what I need?
Thank you very much for any light!
Federica


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index