Statalist


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

Re: st: Forvalues, syntax error


From   "Gauri Khanna" <gwkhanna@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Forvalues, syntax error
Date   Thu, 05 Jul 2007 14:13:58 +0000

Dear Neil,

Thank you for your prompt suggestion. I tried your suggestion and I seem to get an error at the beginning. I have only copied a couple of lines from the start to the point where the problem is identified.

Do you have any insight as to why the problem occurs? Thank you so much for your help.

set more off
set matsize 5000
set trace on
set tracedepth 2

use `allsvys1', clear
egen i=group(un_region2 sex_code) if excind!=1 & sex_code!=3 & total_age_group!=1 & agegrp==0
summarize i
local max1=r(max)
gen error1=.
gen error2=.
save `allsvys', replace


forvalues svy = 1/`max1' {
THIS IS THE ERROR I GET
- forvalues svy = 1/`max1' {
= forvalues svy = 1/. {
invalid syntax
r(198);

Sincerely,

Gauri


From: "Neil Shephard" <nshephard@gmail.com>
Reply-To: statalist@hsphsun2.harvard.edu
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Forvalues, syntax error
Date: Thu, 5 Jul 2007 14:48:15 +0100

Thats quite a bit of code for people to read through.

You could try "debugging" this by using the -set trace on- and setting
an appropriate -tracedepth- and then running your do-file.

Something like...

. set trace on
. set tracedepth 2
. do [your-do-file]

..will be more verbose, and should allow you to see which line is
causing your problem.  This would be a lot quicker than others trying
to read through the syntax.

If your not sure why the offending line is invalid post that
particular line as its interpreted to the list and someone might be
able to say what is wrong with the syntax.

Neil

--
"In mathematics you don't understand things. You just get used to
them."  - Johann von Neumann

Email - nshephard@gmail.com / n.shephard@sheffield.ac.uk
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/
*
*   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/
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

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