0
votes

I have a number of csv data sets where each data set has up to 5 variables. The variable names are alpha numeric (z1,z2,z3,z4 and z5 are the variable names). So, each data set can have any number of combinations of the variables above with a max of up to 5 variables. I need to run proc reg with predictor variables being all the variables that are in any particular data set. For example if my 1st data set has z1 and z2 as the variable names, I need to run prog reg with z1 and z2 as the predictor variables. If the next data set has z2 z4 and z5 as the variables, I need to run proc reg with z2 z4 and z5 as the predictor variables. The y variable is in a separate data set.

Now, my question is how do I tell sas to use the the variables of the corresponding data set as the predictor variables for proc reg? I have a macro loop set up already to read each individual data set. But I dont know how to use the macro to provide the predictor variables under proc reg.

Any help will be greatly appreciated. Thank you

1

1 Answers

0
votes

If you do not have any other variables that start with Z then you should be able to use Z: to create a variable list.

proc reg data=have ;
   model dependent = z: ;
run;