Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Add obs with values so each possible value occurs at least once |
Date | Mon, 10 Mar 2014 16:23:51 +0000 |
Suppose your dataset is saved as -work- and the variable in question is -id-. clear set obs 100 gen id = _n merge 1:m id using work Nick njcoxstata@gmail.com On 10 March 2014 16:12, Jen Zhen <jenzhen99@gmail.com> wrote: > I have what should be an easy question, yet I don't find the answer: > > I have a dataset in which var1 takes 74 out of the 100 possible > integer values between 1 and 100 inclusive. Some of the values occur > more than once. I would like to expand the dataset such that each of > the 100 possible values occurs at least once. > > How do I do that? * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/