Statalist


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

st: RE: Help building an ado file from a do file


From   "Steichen, Thomas J." <SteichT@RJRT.com>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Help building an ado file from a do file
Date   Sat, 21 Feb 2009 11:06:36 -0500

There are no special restrictions on creating new variables in an ado; variables used in an ado do not need to exist prior to the ado execution.

However, if you used the -tempvar- command to identify NewCompanyNum in your ado, you need to refer to it as `NewCompanyNum' later in your ado. (The advantage of using -tempvar- is that so-identified variables are guaranteed not to clash with pre-existing variables and are automatically deleted when the ado finishes.)

If you did not use -tempvar-, then NewCompanyNum will be created as a permanent varible in your dataset, same as if you typed the egen command from the command line.

These same isues apply to CompanyNum.

Tom

-----------------------------------
Thomas J. Steichen
steicht@rjrt.com
-----------------------------------

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Thomas Jacobs
Sent: Friday, February 20, 2009 5:10 PM
To: StataList
Subject: st: Help building an ado file from a do file

I am trying to convert a called do file to an ado with little success.
 Besides inserting the program line at the top and end line at the
bottom, I have made no changes to the working called do version which
is executed with a number of arguments passed from the calling
program.  The error I keep getting is

variable NewCompanyNum not found
(error occurred while loading CalledPooledModel.ado)

without pasting the entire program here, the variable NewCompanyNum is
created within the ado itself with the following steps:

*Create contiguous variable
egen NewCompanyNum = group(CompanyNum)
summ NewCompanyNum
local Count = r(max)
dis `Count'

where CompanyNum is a numeric variable assigned to the starting
company data well upstream of this program.  Is there some restriction
on creating a new variable in the ado?  Do all the variables it uses
have to exist prior to its execution?  Thanks for any suggestion
anyone might have.

Tom

--
Thomas Jacobs

*
*   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/

CONFIDENTIALITY  NOTE:  This e-mail message, including any attachment(s), contains information that may be confidential, protected by the attorney-client or other legal privileges, and/or proprietary non-public information. If you are not an intended recipient of this message or an authorized assistant to an intended recipient, please notify the sender by replying to this message and then delete it from your system. Use, dissemination, distribution, or reproduction of this message and/or any of its attachments (if any) by unintended recipients is not authorized and may be unlawful.

*
*   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/



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