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: AW: st: AW: Syntax forvalues in Stata 11 SE


From   Neil Shephard <[email protected]>
To   [email protected]
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 <[email protected]> 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 - [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index