Statalist


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

Re: st: RE: RE: Calling a Do-file


From   "Sergiy Radyakin" <serjradyakin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: RE: Calling a Do-file
Date   Thu, 23 Oct 2008 11:39:17 -0400

Jason probably has experience with other programming environments
where a 'variable' denotes a named memory address where a particular
value is stored, which is restricted to the current scope unless
declared global. In Stata 'variables' are columns in the dataset (rows
are called 'observations') and there is only one dataset that Stata
may work with at a time. 'locals' and 'globals' are equivalents of
what is called 'variables' in other programming languages. This is
explained in the FAQ somewhere. Variables in the data are always
visible to any part of the code, no matter how deep the calls are
nested.

I'd suggest Jason to look through these definitions and perhaps
rephrase the question in Stata's terms.

Regards,
   Sergiy




On Thu, Oct 23, 2008 at 5:14 AM, Martin Weiss <martin.weiss1@gmx.de> wrote:
> It is not clear what you are trying to achieve. I am thinking that you want
> some kind of counter. Then say -loc j 0- and step the counter with -loc
> ++j-. No need for a variable there. If you want something else, please say
> so...
>
>
> HTH
> Martin
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of jasonm@ucla.edu
> Sent: Thursday, October 23, 2008 11:07 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: RE: Calling a Do-file
>
>> You can nest up to 64 do-files. See -h limits-
>
> Yes, but you can change the value of a variable in one do-file from a
> different do-file?
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of jasonm@ucla.edu
> Sent: Thursday, October 23, 2008 9:07 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Calling a Do-file
>
> Is there a way to run a do-file (ie secondary do-file) from inside
> another do-file (ie primary do-file) and change a variable inside the
> secondary do-file?
> For example,
> replace j=1
> do "C:\xyz.do"
> replace j=2
> do "C:\xyz.do"
>
> *
> *   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/
>
> *
> *   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/
>
*
*   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