Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: R: Gen & replace commands


From   "Carlo Lazzaro" <[email protected]>
To   <[email protected]>
Subject   st: R: Gen & replace commands
Date   Fri, 26 Oct 2007 18:59:32 +0200

Dear Ziad,

at first glance it would seem that you have omitted one more = after if (ie:
you should have typed if drug1==1 instead of if drug1=1).

 HTH

King Regards,

Carlo

-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di Ziad El-Khatib
Inviato: venerd� 26 ottobre 2007 18.42
A: [email protected]
Oggetto: st: Gen & replace commands

Hi!
Patient was using either "drug1" and "drug2".
I am trying to create new category to put the value of adherence to
the two drugs in one column (drugcat). Drug1 and drug2 have values of
1, 2, 3 or empty.

i tried


gen drugcat=0
replace drugcat=drug1 if drug1=1 | drug1=2 | drug1=3
replace drugcat=drug2 if drug2=1 | drug2=2 | drug2=3




it is giving invalid syntax.

Any tips?!
Thank you in advance and best regards
ziad
*
*   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/



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