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


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

Re: AW: st: AW: Syntax forvalues in Stata 11 SE


From   Neil Shephard <nshephard@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: AW: st: AW: Syntax forvalues in Stata 11 SE
Date   Thu, 23 Sep 2010 13:19:18 +0000

Listen to Nick Cox's comment, as I don't understand why you have...

On Thu, Sep 23, 2010 at 1:07 PM, Gauri Khanna <gwkhanna@hotmail.com> wrote:
> *use `allsvys1', clear /*OLD CODE: STATA 9*/
> use "'allsvys1'", clear

There was no change in syntax between Stata 9 and 11 as to the use of
single quotes when referring to tempfiles.

What your new code is doing is saving a file in the current directory
as 'allsvys1'.dta and NOT saving it as the tempfile you are declaring
at the start of your do-file.

>     foreach x of local names {
>         if "`x'"=="lgsmkc" {
>             display "`x'"
>             gen row'j'=lgcigc
>             local j='j'+1
>         }
>         if "`x'"=="midage" {
>             display "`x'"
>             gen row'j'=midage
>             local j='j'+1
>         }
>         if "`x'"=="agesmkc" {
>             display "`x'"
>             gen row'j'=agecigc
>             local j='j'+1
>         }
>         if "`x'"=="_cons" {
>             display "`x'"
>             gen row'j'=1
>             continue, break
>         }
>     }

All of the references to the local macro j in this are wrong they
should be `j' and not 'j'

I'd be inclined to go back to your original code, and try running
under version control by a adding the line -version 9.0- at the top of
your do-file, it should run fine.

As per Martin's point, how are you running your do-file?

Are you sending the whole thing from the do-file editor, typing -do
mydo-, highlighting a section of your do-file and sending it to Stata
to run (if so which parts).

Neil

-- 
"One should as a rule, respect public opinion in so far as is
necessary to avoid starvation and to keep out of prison, but anything
that goes beyond this is voluntary submission to an unnecessary
tyranny, and is likely to interfere with happiness in all kinds of
ways..." - Bertrand Russell

Email - nshephard@gmail.com
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/

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