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: Stata commands : multiple commands in one text line is allowed


From   "Allan Reese (Cefas)" <[email protected]>
To   <[email protected]>
Subject   st: Stata commands : multiple commands in one text line is allowed
Date   Fri, 20 Jul 2012 14:54:16 +0100

>> On Thu, Jun 28, 2012 at 11:18 AM, Pradipto Banerjee asked:
Is there a way in Stata to define ";" to interpret a carriage return?
>> For example, in my ado or do codes, I would like to write in a single line
>>    by xxx: gen yyy=zzz ; by xxx1: gen yyy1=zzz1 ; by xxx2: gen yyy2=zzz2

On Thu, Jun 28, 2012 at 11:40 AM, Richard Herron suggested:
> Try -#delimit ;- to get a semicolon delimiter.  -#delimit cr- to get back to the default.
>
> (But I guess this is different than your ultimate desire to have more
>  than one command per line, which I don't think can be done.)

I thought the same as Richard but Kreshna Gopal has put me right.  I can find no mention of this on the list or in documentation, where #delimit is described for the facility to split a long command over several lines.  And I think we are all brainwashed to think that of a Stata command as a line.  

However, within a DO/ADO file:

#delimit ;
set obs 10; g x=1; g y=2; list ;

works and so does this, though this example seems very bad style!

* This line is comment ; di "Fooled you!" ;

The main use I see is to pack several short assignments on one line so the vertical blocking in the text is more visible in a screen window; it doesn't appear to save measurable time or storage space. 

Allan


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