Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Do file glitch?


From   [email protected]
To   [email protected]
Subject   Re: st: Do file glitch?
Date   Thu, 21 Sep 2006 19:32:32 +0200 (CEST)

I habitually put -exit- in the last line of your do-files. This prevents
me from forgetting a carriage return behind the last "important" command,
and  allows me to expand a little bit on the contents of the do-file
behind -exit-. Here is an example:

-----------------xyz.do
version 9.2
capture log close
log using xyz, replace
use xyz, replace
tab myvar
exit

This is just a silly example to show how -exit- might be used. Some not so
silly examples can be found in the book "Data Analysis Using Stata".
----------------------

many regards
Uli

> You might be missing a carriage return, line feed, or some combination
> of these at the end of your do file.  Try putting in one more
> extraneous command (e.g. -ds-), or hit Enter a few times, at the end
> of the file.
>
> On 9/21/06, Rachel S <[email protected]> wrote:
>> I have a do file with the following nested loop structure
>>
>> forvalues num=1/3 {
>> foreach suf in AA BB CC {
>> gen phonepref`num'`suf' = phone`suf' * pref`num'`suf'
>>        }
>> }
>>
>> When I run the do file, it gives me an "unexpected end" error and, in
>> printing out the for loop, doesn't see the last curly bracket.  On the
>> other hand, it works fine when I paste it into the command box.


*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index