Hello everyone, I am writing a .ado file that is supposed to mimic what
would be done by a "function" in other languages. The problems I'm
running into are:
(1) that I would like to temporarily create some extra variables but I
don't want their names to conflict with the names of variables that the
user might already have in the dataset. I.e. if I write in the .ado file
"syntax varlist" to query the user for the variables he/she wants to use
in calling the .ado file, and then I go through the local "varlist" and
give them NAMES so that I can refer to them in the body of the .ado file,
I'm worried that I might name them something that the user might already
have in the dataset for something else (or even for that SAME variable).
Is there a way to make sure that there is no conflict in the names? I
know there is a "tempvar" statement so that the variables will be dropped
after the .ado file completes, but I am worried that they might actually
not be CREATED due to the name already being used for something else...
(2) Is there a way to FORCE stata to return a function after the .ado file
completes? So far, I have just been creating scalars and matrices inside
of the .ado file, but I think this is probably not that efficient for my
purposes since I really want the function ITSELF to take on a value or a
matrix.
(3) If you call a .ado file from inside another .ado file, can I pass in
the syntax statement from the outer file? I.e. if I write in the "outer"
file that the user sees: "syntax varlist", and then call the inner .ado
file as "inner `varlist'" does that make sense? I wasn't sure whether I
was allowed to use this macro in this way.
THANKS SO MUCH!!!
Florence
*
* 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/