Hi all,

I'm creating a STATA program that will:
1. open a dataset,
2. keep a user defined list of variables,
3. save these to a temporary file,
4. loop through numerous other datasets, repeating the above, appending the users variables to the temporary file.

The program runs fine when no variables are specified in the programs command (i.e. getdata, options) as I have the following in my program:

if "`varlist'" == "" {

local varlist "x y z"

}

However, when the user includes a list of variables when entering the programs command (i.e. getdata x y z, options), STATA returns a "no variables defined" error message.

No dataset is open when the user runs the program and I think that is the problem I'll need to get around.

Thanks for any help.