Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Joe Canner <jcanner1@jhmi.edu> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: find the corresponding values between two variables |

Date |
Wed, 16 Apr 2014 19:00:35 +0000 |

The problem as I understand it (which may not be correct) is that the entry with c_est==13 is not just a problem for that observation but its presence makes all of the rest of the observations mismatched as well. What might help here is to -reshape- the dataset so that all (c_est,c_trab) pairs can be identified and all unmatched cases eliminated. Or, if you'd rather, just reshape again based on the c_ variables and make the mismatches have a missing partner. Something like: gen id=_n reshape long w_ c_, i(id) j(j) string replace id=c_ reshape wide c_ w_, i(id) j(j) string This assumes that your c_ variables are unique. If not, you will have to modify this or do something else entirely. Regards, Joe Canner Johns Hopkins University School of Medicine -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: Wednesday, April 16, 2014 2:38 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: find the corresponding values between two variables Not clear what you want (or what you tried: you show no code) but does gen diff = w_est - w_trab if c_est == c_trab or gen OK = c_est == c_trab edit if OK help? Nick njcoxstata@gmail.com On 16 April 2014 19:31, Sara Neto Machado <mail@saramachado.com> wrote: > Dear all, > > c_est----w_est---c_trab----w_trab > 10----------10-----------10-------11 > 11-----------3------------11-------3 > 13-----------4-------------17-------5 > 17------------5-------------18-------7 > 18---------10----------------23-----3 > 23-----------5----------------25-----6 > > my aim is to perform the differences between w_est and w_trab for the > same values of c_est and c_trab. However, I have along the dataset as > well as values that do not coincide in c_trab and c_est (Eg from the > sample: 13) that "ruins" the sorting between those columms. I want the > 13 to appear like missing values on the same line of c_trab. I am > trying to search any syntax that suits my purpose and nothing relevant > came up. Maybe there are other alternatives that I am not seeing now.. > > Can anyone help me? much appreciated! > > regards, > Sara > * > * 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/ * * 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/ * * 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/

**Follow-Ups**:**Re: st: find the corresponding values between two variables***From:*Sara Neto Machado <mail@saramachado.com>

**References**:**st: find the corresponding values between two variables***From:*Sara Neto Machado <mail@saramachado.com>

**Re: st: find the corresponding values between two variables***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**st: RE: Preventing -estout- from overwriting e(labels) in successive runs** - Next by Date:
**Re: st: find the corresponding values between two variables** - Previous by thread:
**Re: st: find the corresponding values between two variables** - Next by thread:
**Re: st: find the corresponding values between two variables** - Index(es):