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]

AW: st: AW: Double Loop - Invalid Syntax


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: AW: Double Loop - Invalid Syntax
Date   Wed, 28 Apr 2010 17:06:14 +0200

<> 

Note, though, I was only talking about the first index per loop. If you want
the inner loop to get input from the outer loop, as in your


*************
foreach `i' of num 1/`j'{
*************


the "`j'" is correct, while the "`i'" is not.


HTH
Martin

Von: [email protected]
[mailto:[email protected]] Im Auftrag von
[email protected]
Gesendet: Mittwoch, 28. April 2010 17:03
An: [email protected]
Betreff: Re: st: AW: Double Loop - Invalid Syntax

Martin,

Such a simple fix and it worked...
Merci!


Alexandre Vialou

This e-mail and any attachments contain URS Corporation confidential
information that may be proprietary or privileged. If you receive this
message in error or are not the intended recipient, you should not retain,
distribute, disclose or use any of this information and you should destroy
the e-mail and any attachments or copies.



"Martin Weiss" <[email protected]>

"Martin Weiss" <[email protected]> 
Sent by: [email protected] 
04/28/2010 09:54 AM 
Please respond to
[email protected]


To

<[email protected]>

cc


Subject

st: AW: Double Loop - Invalid Syntax






<> 



You are way too keen to dereference, I would say: - foreach j of num 1/100{-
instead of - foreach `j' of num 1/100{-, and the same for the  other
loops...



HTH
Martin

Von: [email protected]
[mailto:[email protected]] Im Auftrag von
[email protected]
Gesendet: Mittwoch, 28. April 2010 16:52
An: [email protected]
Betreff: st: Double Loop - Invalid Syntax

Stata Listers,

Even though it is a simple macro, I cannot find where the invalid syntax
comes from. 
Instead of creating new variables, I want to create new files.
Any help will be greatly appreciated

foreach `j' of num 1/100{
clear
foreach `i' of num 1/`j'{
use "/aaa/aaa/nvessel.dta"
keep if nvessel ==`j'
gen round = `i'
save "/aaa/aaa/nvessel`i'.dta", replace
}
foreach `i' of num (`j'-1)/1{
append using "/aaa/aaa/nvessel`i'.dta"
}
save "/aaa/aaa/vessel_list`j'.dta", replace
}



Alexandre Vialou


This e-mail and any attachments contain URS Corporation confidential
information that may be proprietary or privileged. If you receive this
message in error or are not the intended recipient, you should not retain,
distribute, disclose or use any of this information and you should destroy
the e-mail and any attachments or copies.


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