1

如何从视图创建表?

视图命名A-> 表命名A

我只找到proc sqlanddata set语句,但是 sas 中是否有任何本机功能?

4

1 回答 1

3
/* create a table as a copy of data from view by SQL ... */

proc sql;
create table A_COPY as select * from A;
quit;

/* ... or by DATA step */
data A_COPY;
set A;
run;

/* Delete the view A 
  and rename the table to original view name */
proc datasets lib=work nolist;
delete A / mt=view;
change A_COPY = A / mt=data;
quit;

编辑:

您可以通过“描述”将创建 DATA 步骤视图或 SQL 视图的代码检索到 LOG:

data A /view=A;
    set sashelp.air;
run;

data view = A;
    describe;
run;



proc sql;
create view A as select * from sashelp.air;
describe view A;
quit;
于 2012-07-23T10:27:03.667 回答