I am trying to convert some long lists of values in Excel and I basically need to create a long list of foreach and forvalues loops which I will then transfer to STATA to execute. When I try to program a loop in one single line, I keep getting 'program error: code follows on the same line as open brace'. Is there a delimiter I could put in the code so I can keep it in one line. This is the code I am trying to use. Sorry but I am a bit rusty in my STATA.
foreach i = "C30.0", "C31" {forvalues j = 8004, 8032, 8050(1)8076, 8078, 8083(1)8084, 8123, 8560, 8980 {display `i';",";`j' } }
Thanks again
Neville
Related Posts with forvalues or foreach loop in one line of code
How to Save a File After a String ValueHello. This should be rather easy for folks here, but I am stymied. I have a rather simple dataset;…
Preparing Panel Data with repeated time values within panel (xtset)Hey everyone, I am working with survey data (PSID) and am currently facing some difficulties regardi…
Fitting Large, Multidimensional Tables to a Word DocumentHi all - hoping folks can help me manage a large multi-dimensional table that I need to output to a …
how to loop with tab2xl?I tried to use tab2xl in a loop to generate sheets faster, but after running the code there's no fil…
Analyzing individual quiz scores with group quiz scoresDear Statlist experts, I have a data set of the performance of graduate course participants (n=30).…
Subscribe to:
Post Comments (Atom)
0 Response to forvalues or foreach loop in one line of code
Post a Comment