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

st: RE: Adding missing observations explicitly to a data file


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Adding missing observations explicitly to a data file
Date   Sat, 1 Oct 2005 17:38:03 +0100

Michael Blasnik quite rightly pointed you 
to -fillin-. But if you use -tsset- then 
it would not seem that you need to add 
these observations. Clearly they will 
add no information to your data, just bloat. 

Either way, do check out -tsfill-. 

Nick 
n.j.cox@durham.ac.uk 

Jonas Dovern
 
> 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.
> 

*
*   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