Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Linking a patient file with an event file


From   Lisa Cook <hlthsrvcsphd@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Linking a patient file with an event file
Date   Sun, 3 Mar 2013 14:30:37 -0500

Thank you, Carl.

The code you suggested worked, but once the reshaping is done, I no
longer have an edcount variable (it turns into edcount1, edcount2,
edcount3, etc.). I thought maybe I could use a macro to replace all
the values of edcount with 1 if nonmissing and 0 if missing, then sum
them to get a new count variable. I thought I would try doing it one
step at a time, since I'm inexperienced with macros.

foreach var of varlist `edcount?' {
  replace `var' = 1 if `var' !=.
}

This results in the error "varlist required". Any ideas?

Thanks!
Lisa
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index