As I understand this, and I don't really:
1. -fillin- is not relevant here. -fillin- is for
cross-combinations, not individual variables.
2. If the problem is literally as described, the quickest
way is to look at a -list- and then add the extras
by -input- or -edit-.
3. You could automate this by
local full 1 2 3 4 5
levelsof HACODE, local(actual)
local toadd : list actual - full
foreach t of local toadd {
set obs `=_N + 1'
replace HACODE = `t' in l
}
Nick
[email protected]
Rafal Raciborski
> try -fillin-
Gianfranco Spiteri
> > I have a variable, which can have up to 5 observations. The
> observations may
> > be any integer from 1 to 5. Each number may be there only
> once but I could
> > have less than 5 observations in total.
> > I am trying to find a way of going through the list,
> identifying which
> > numbers are missing and appending these numbers to the
> dataset. Does anyone
> > have a relatively simple way of doing it?
> >
> > an example would be as follows:
> >
> > HACODE
> > 1
> > 3
> > 5
> >
> > and the end result would be
> >
> > HACODE
> > 1
> > 3
> > 5
> > 2
> > 4
*
* 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/