Bookmark and Share

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]

st: egen with user-defined function


From   Jan Barendregt <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: egen with user-defined function
Date   Tue, 20 Aug 2013 00:03:44 +0000

Hi all,


I'm trying to let egen to use a user-defined function. Here is what I'm doing:

do "C:\Ddrive\MattCooper\Data\test.do"

. capture program drop _grecordparse

. program define _grecordparse
  1. local bool=0
  2. local li=1
  3. local i=0
  4.   while `i' < RECORD_AXIS_COUNT {
  5.   if (substr(RECORD_AXIS_DATA,`li',4)>="A410") & (substr(RECORD_AXIS_DATA,`li',4)<="A419") local bool=
> `bool'+1 
  6.   local li=`li'+4
  7.   local i=`i'+1
  8.   }
  9.   gen `typlist' `varlist' = `bool'
 10. end             

. 
end of do-file

. egen sepsis=recordparse
unknown egen function recordparse()
r(133);


So I can't get egen to recognise my recordparse function. Any ideas?

I'm using Stata 11.2 on Windows

Thanks,

Jan


------------------------------------------
Jan J Barendregt, MA, PhD
Assoc Prof of Epidemiological Modelling
School of Population Health, University of Queensland
Email: [email protected]
Skype: janbarendregt
Phone: +61 7 3365 5584


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index