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: foreach loop over all variables

From   "Seliger Florian" <>
To   "''" <>
Subject   st: foreach loop over all variables
Date   Thu, 23 Feb 2012 09:31:35 +0000

Dear Statalist,

Maybe that's a silly question, but Google didn't give any answers:

I want to create a loop with foreach over ALL variables in a dataset,


It is not possible to write

foreach var1-var100

because the number and names of the variables vary from dataset to dataset and the do-file has to work for any dataset without making any changes.

Thanks a lot.

Best wishes,

Florian Seliger
ETH Zurich
KOF Swiss Economic Institute
Weinbergstrasse 35
8092 Zurich, Switzerland
+41 44 632 37 17 phone
+41 44 632 12 18 fax 

*   For searches and help try:

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