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, is already up and running.

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

RE: st: AW: Doubt on the exexcution of a do file?

From   Nick Cox <>
To   <>
Subject   RE: st: AW: Doubt on the exexcution of a do file?
Date   Fri, 21 May 2010 11:33:23 +0100

Evidently there is. As I guess at it, 

1. Stata is holding the do-editor contents in its own area and has total
control over them, so it's smart enough to know where the contents end. 

2. But a do-file could be, and very often is, just a file created by
something else outside Stata. Whether it ends with end-of-line
characters (which depending on OS might not necessarily be just carriage
return) is beyond Stata's control. 

You may say why the difference? Can't Stata just supply the missing
character(s)? That's a good question, and I don't know the complete
answer. But I think if you go back long enough it was common for files
to contain characters beyond the last end-of-line. Early Statas
certainly used the rule "go up to the last end-of-line and not beyond"
and StataCorp has seen no reason to change that. 


Grace Jessie

Adding a carriage return at the end of the last line works well.
BTW, if I open the do file I wrote  in the Stata-do-file editor and
the do button, it goes well no matter there is a carriage return or not.
Any difference?

> Stata needs to see a carriage return at the end of the -keep make-
> otherwise it will refuse to execute the line. So insert a blank line
> it, or put the command -exit- on the next line, as recommended by J.
> Long, in his book on page
> The latter strategy allows you to put an unlimited amount of comments
on the
> lines following -exit-.

Grace Jessie

> I wrote a do file and saved it as a do file named
"".Accidently, I
> found if there was no space after the last typing in the do file and I
> the do file in the command window, the last typing in the do file will
> be excecuted.
> For example,
> The contents of is,
> sysuse auto, clear
> keep make //note: there is no excess space after "make".
> I typed the following in the command window of Stata,
> do
> Unfortunely, the "keep make" was not exexctued.

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index