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]

st: RE: assign several lines of syntax to local?


From   philippe van kerm <philippe.vankerm@ceps.lu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: assign several lines of syntax to local?
Date   Thu, 12 Aug 2010 17:35:09 +0200

A simple alternative to trying feeding commands in a local is to define a -program- in the do file, e.g.

program define chunk
  display "whatever"
  summarize
  count
  codebook
end

use file1
...
chunk
...
use file2
...
chunk
...
etc.


Philippe



> -----Message d'origine-----
> De : owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] De la part de raoul reulen
> Envoyé : Thursday, August 12, 2010 11:33 AM
> À : statalist@hsphsun2.harvard.edu
> Objet : st: assign several lines of syntax to local?
>
> Hello All
>
> I have a large do-file in which a few lines of syntax come back
> several times. It is possible to assign a local to the lines of syntax
> so that I don't have to repeat it all the time? I don't want to use a
> loop for this. The "include" command does something similar, but I
> would have to save the relevant syntax in a separate file which I
> don't want. So, essentially I would like to assign several lines of
> syntax to a local, is this possible? Are there alternatives? Thanks.
>
> BW
>
> Raoul
> *
> *   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   |   Site index