Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Generate new variable "by" question


From   "Dale Steele" <Dale_Steele@brown.EDU>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Generate new variable "by" question
Date   Sun, 21 Jul 2002 22:10:09 -0400

minus the value of response when resistnc is 0.  Seems like I should use the
"by" command, but I'm having a hard time creating working code. My efforts
thus far ...

 by idnum: generate cresponse = response - (the value for response given
resistnc = 0 for each idnum)

. list idnum resistnc response

         idnum   resistnc   response
  1.       401          0        .14
  2.       401        2.5       2.42
  3.       401          5       3.76
  4.       401         10       4.74
  5.       401         20       7.88
  6.       401         30       8.52
  7.       402          0         .4
  8.       402        2.5       1.46
  9.       402          5       1.58
 10.       402         10       4.08
 11.       402         20          6
 12.       402         30       8.94

Thanks...
    Dale Steele


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index