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

From |
"Carlo Lazzaro" <carlo.lazzaro@tiscalinet.it> |

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

Subject |
st: R: RE: R: Merging obervations of two variables |

Date |
Wed, 15 Oct 2008 09:57:49 +0200 |

Dear Martin, I agree with you in full. I do not know if codes 1 and 2 have some further useful meaning for Beatrice. Otherwise, I have probably missed some details of Beatrice's thread. Kind Regards, Carlo -----Messaggio originale----- Da: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di Martin Weiss Inviato: mercoledì 15 ottobre 2008 9.27 A: statalist@hsphsun2.harvard.edu Oggetto: st: RE: R: Merging obervations of two variables Carlo, what is your example supposed to add as an additional insight? The way you construct your dataset, the -if- qualifier is always true. ********** clear* set obs 10 g time=10*(uniform()) g target_var=time ********** brings about the same result... HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Carlo Lazzaro Sent: Wednesday, October 15, 2008 9:15 AM To: statalist@hsphsun2.harvard.edu Cc: 'Beatrice Crozza' Subject: st: R: Merging obervations of two variables Dear Beatrice, If I have understood your query well, it seems that the problem lays in a misuse in & operator in your first syntax sketch. Please try the following one: -------------begin example------------ set obs 10 g time=10*(uniform()) g code=1 in 1/10 replace code=2 in 3/6 g target_var=time if code==1 | code ==2 -------------end example------------ HTH and Kind Regards, Carlo -----Messaggio originale----- Da: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di Beatrice Crozza Inviato: mercoledì 15 ottobre 2008 0.39 A: statalist@hsphsun2.harvard.edu Oggetto: st: Merging obervations of two variables Dear all, maybe this is a simple question, but I don't know how to overcome my problem. I have a variable time and I should generate another variables equal to time when another variable (code) is equal to 1 or 2. However, I don't know how to instruct stata for this. I tried with: gen time1= time if code==1 & code==2 but of course I will have all missing values. Thus, I created two variables: gen time1= time if code==1 gen time1= time if code==2 but I would like to merge the values of the two variables at this point. Any idea of how to do this? Thank you. Best, Bea * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/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/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/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/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: RE: R: Merging obervations of two variables***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**st: RE: R: Merging obervations of two variables** - Next by Date:
**Re: st: adjusted R2 in survey regression** - Previous by thread:
**st: RE: R: Merging obervations of two variables** - Next by thread:
**st: adjusted R2 in survey regression** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |