DATA Step, Macro, Functions and more

Create a dataset of variables generated sequentially in a %until loop

Reply
Contributor
Posts: 20

Create a dataset of variables generated sequentially in a %until loop

%do %until (&Max_V1. le 5);

a few more lines of code goes here........then ......

proc sql;
Select Variable INTO: Drop_Var
from Spdework.varlist where VarianceInflation = (select max(Varia) as MV
from varlist);
quit;
Question
*At each iteration &Drop_Var contains a new variable. How can I create a new Dataset at this stage to hold all variables generated by &Drop_Var as observations.


proc sql;
Select Variable INTO: L_F_Vars SEPARATED by ' '
From Varlist
Where Variable "&Drop_Var.";
quit;



%END;

%mend auto_vif;

Message was edited by: DB_ECON Message was edited by: DB_ECON
Super Contributor
Super Contributor
Posts: 3,174

Re: Create a dataset of variables generated sequentially in a %until loop

You will need to generate the SAS code and use CREATE TABLE, or consider a DATA step approach where you can create more than one SAS member/table with a single pass of an input file, again with your SAS macro code needing to generate the DATA statement parameters and associated OUTPUT statements.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 1 reply
  • 113 views
  • 0 likes
  • 2 in conversation