| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Generate question
This should do it:
bys y (x): replace x=x[1]
hth,
Jeph
Hendri Adriaens wrote:
Hi,
I need to do the following. I have data in x and y. x are names and y are
numbers. The names and numbers are one-to-one. A specific x,y combination
occurs many times. x has some missing values, but the value could be found
elsewhere in x via the link in y, which is complete. So, if x is missing,
search in the dataset to find the x with that y.
How can I do this easily? I tried the following:
1) drop the missing observations from x
2) make a collapse of x and y (to get unique combinations)
3) save that to a file
4) open original data again, merge it on y with temporary file, uniqusing.
It complains that y doesn't uniquely identify the master data, which is
obvious. But x hasn't changed a bit after this operation and the _merge
variable is 1 where x was missing. But the numbers y associated with these
observations certainly do occur in the temporary file.
Is there a better and working way?
Thank you, best regards,
-Hendri Adriaens.
--------------------------------
Hendri Adriaens
Researcher CentERdata
Tilburg Universiteit
Room K638
Warandelaan 2
PO Box 90153
5000 LE Tilburg, The Netherlands
Tel.: +31-13-466 3263 / 8325
Fax.: +31-13-466 2764
E-mail: [email protected]
WWW: http://www.centerdata.nl
*
* 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/
*
* 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/