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]

Re: st: unexpected end of file


From   Sarah Elizabeth Edgington <[email protected]>
To   [email protected]
Subject   Re: st: unexpected end of file
Date   Mon, 16 Aug 2010 20:46:36 -0700

.
Try sticking a blank line after end. Depending on your text editor, there may not be an end of line character at the end of the line so Stata ignores it and never finds the "end" command. Adding that blank line makes sure the text editor ends that line correctly.
-Sarah


At 08:02 PM 8/16/2010, you wrote:
I removed all comments for the time being so that's not an issue. I really don't
know what's wrong. Why would I get the same error for this program as well:

program define mean2
version 10.1

syntax varlist(min=1 max=2)

foreach var in `varlist' {
su `var',mean
di as text "Mean for `var': " as res r(mean)
}

end

. sysuse auto, clear
. mean2 price mpg
Mean for price: 6165.2568
Mean for mpg: 21.297297

when I save the program as mean2.ado, copy it to ado/updates, and say -mean2
price mpg- Stata returns:

unexpected end of file
(error occurred while loading mean2.ado)
r(612);

DF Tilley






----- Original Message ----
From: Martin Weiss <[email protected]>
To: [email protected]
Sent: Fri, August 13, 2010 8:33:16 AM
Subject: RE: st: unexpected end of file


<>

A search for the term "unexpected end of file" would have yielded many hits
in the Statalist archive. Among them:
http://www.stata.com/statalist/archive/2010-07/msg00321.html



HTH
Martin

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ronan Conroy
Sent: Freitag, 13. August 2010 14:26
To: [email protected]
Subject: Re: st: unexpected end of file

On 12 Lún 2010, at 18:21, Dani Tilley wrote:

> I've wrote a Stata command and saved it as a .ado and copied on my ado
> directory. When I start Stata and run the command, I get the
> following error:
>
> unexpected end of file
> (error occurred while loading command.ado)

Check too for a unbalanced literal quotes or comments.


Ronan Conroy
=================================

[email protected]
Royal College of Surgeons in Ireland
Epidemiology Department,
Beaux Lane House, Dublin 2, Ireland
+353 (0)1 402 2431
+353 (0)87 799 97 95
+353 (0)1 402 2764 (Fax - remember them?)
http://rcsi.academia.edu/RonanConroy

P    Before printing, think about the environment





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


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