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

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

st: Double Loop - Invalid Syntax

Subject   st: Double Loop - Invalid Syntax
Date   Wed, 28 Apr 2010 09:51:47 -0500

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{
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.

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index