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: STATA won't read command


From   "Mason, Patrick" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: STATA won't read command
Date   Fri, 7 Mar 2014 05:08:10 +0000

Thanks. I loaded the Word file into STATA's do-file editor and used the editor to write the apostrophes. I saved the file under a different name. It works like a charm. I appreciate the help.

________________________________________
From: [email protected] [[email protected]] on behalf of Richard Williams [[email protected]]
Sent: Thursday, March 06, 2014 9:43 PM
To: [email protected]; [email protected]
Subject: Re: st: STATA won't read command

As to why that happened, I am guessing that Word changed the
apostrophes to smart apostrophes, which may look nice when writing
text but will screw you up when trying to write code for programs. In
general, don't use Word for writing programs. Use a text editor or
Stata's do-file editor.

At 09:19 PM 3/6/2014, Sergiy Radyakin wrote:
>Patrick, the answer to your question is 'yes':
>
>clear all
>
>sysuse nlsw88
>rename south region
>
>generate meanwage = .
>by region, sort: gen pid = _n
>
>summarize pid
>
>quietly forvalues i = 1/`r(max)' {
>          generate include = 1 if pid != `i'
>          egen work = mean(wage*include), by(region)
>          replace meanwage = work if pid == `i'
>          drop include work
>}
>
>Just use the correct closing quotes. Stata 13 will indicate that with
>syntax highlighting.
>
>Best regards, Sergiy Radyakin
>
>PS: not sure how your question relates to the earlier posting. Start a
>new thread if not related.
>
>
>On Thu, Mar 6, 2014 at 8:53 PM, Mason, Patrick <[email protected]> wrote:
> > I use STATA/SE 13.1 for Windows (64 bit x86-64)
> >
> > The code appended below works fine on a small hypothetical
> sample. I manually enter the data, then copy the code from a
> Microsoft Word .doc file and past the commands directly into
> STATA's command window. The commands execute without a problem.
> >
> > I place these same commands inside a .do file. I call the do file
> in STATA and the commands do not work!
> >
> > I get the following message.
> >
> > quietly forvalues i = 1/`r(max)' {
> > invalid syntax
> > r(198);
> >
> > Is there a way to save the .do so that the forvalues command will execute?
> >
> > thanks, plmason
> >
> > generate meanwage = .
> >
> > by region, sort: gen pid = _n
> >
> > summarize pid
> >
> > quietly forvalues i = 1/`r(max)' {
> >          generate include = 1 if pid != `i'
> >          egen work = mean(wage*include), by(region)
> >          replace meanwage = work if pid == `i'
> >          drop include work
> > }
> >
> >
> > ________________________________________
> > From: [email protected]
> [[email protected]] on behalf of Z. Liu [[email protected]]
> > Sent: Thursday, March 06, 2014 8:45 PM
> > To: [email protected]
> > Subject: st: Fwd: -cmp- not concave
> >
> > Dear all,
> >
> > I've been trying to fit a bivariate tobit model using the user-written
> > command -cmp-. The model looks like this:
> >
> > cmp (equation1: y1 = X1) (equation2: y2 = y1 + X2), indicators(2 2)
> > robust
> >
> > This model doesn't work out. Stata keeps showing 'log pseudolikelihood =
> > 0 (not concave)'. I tried to start with minimum regressors (1-2
> > explanatory variables) in each equation, but the problem remains. I also
> > tried alternative ml options such as - tech(dfp)- and -difficult- but
> > still can't fix it. However, the two tobit equations can be estimated
> > separately, although the Pseudo R2 is quite small (around 5%). As well,
> > the system model
> > can be estimated if I change the two tobit equations into linear
> > equations. Some descriptive statistics of the two dependent variables
> > are as follows:
> >
> > y1: Percentiles: 1% (0), 25% (0), 50% (23.57), 99% (6127.14); mean
> > (365.00); SD (1186.90); Skewness (7.14); Kurtosis (71.23)
> >
> > y2: Percentiles: 1% (0), 50% (0), 75% (0), 90% (78.10), 99% (1128.53);
> > mean (61.29); SD (401.82); Skewness (13.27); Kurtosis (217.49)
> >
> > Anybody out there knows what might be the problem? Any advice or
> > suggestions
> > would be appreciated. Thanks a lot in advance.
> >
> >
> > Best Regards,
> >
> >
> > Leo
> >
> >
> > *
> > *   For searches and help try:
> > *   http://www.stata.com/help.cgi?search
> > *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
>*   http://www.ats.ucla.edu/stat/stata/

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  [email protected]
WWW:    http://www.nd.edu/~rwilliam

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index