Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Adding missing observations explicitly to a data file


From   "Jonas Dovern" <J.Dovern@student.unimaas.nl>
To   "Stata Forum" <statalist@hsphsun2.harvard.edu>
Subject   st: Adding missing observations explicitly to a data file
Date   Sat, 1 Oct 2005 14:45:16 +0200

Dear all,

I have the following problem: I have several text-files consisting of yearly data for different countries. However, data for some of the years are missing (different years for different countries) without being explicitly noted in the file by using NaN or some similar data entry. E.g. the data set looks like

year country var1
1960 aaa x1
1961 aaa x2
1964 aaa x3
1965 aaa x4

What I want to have is a data set like

year country var1
1960 aaa x1
1961 aaa x2
1962 . .
1963 . .
1964 aaa x3
1965 aaa x4
1966 . .
1967 . .
1968 . .
1969 . .

I tried creating a dataset containing the variable date only for the entire sample and using merge to add the original data set. Unfortunately, I couldn't figure out the right way to yield the desired outcome.
I would appreciate any helpful suggestions. Thanks.

Jonas

_________________________________
Jonas Dovern
Düsternbrooker Weg 148
24105 Kiel
Phone: +49-(0)431-1608746
Mobile: +49-(0)176-21532822
J.Dovern@student.unimaas.nl
Dovern@asp.ifw-kiel.de
_________________________________
*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index