是否可以从SAS视图表中获取源代码?

时间:2019-07-05 09:10:52

标签: view sas

我有一个正常运行的SAS视图表,但是创建该视图的源代码丢失了。 是否可以直接从视图文件本身中提取它?

4 个答案:

答案 0 :(得分:3)

您也可以尝试:

data view = myview;
describe;
run;

如果您在最初创建myview的系统上运行它,则更可能起作用。

答案 1 :(得分:2)

SAS中的许多视图都是使用PROC SQL创建的。 Datastep视图非常罕见。因此DESCRIBE VIEW可能有用。

proc sql;
  describe view VIEWNAME;
quit;

注意:视图代码将被写入日志

答案 2 :(得分:1)

这不是很漂亮,但是您可以从二进制视图文件本身中读取定义。

请参见以下示例:


data myview /view=myview;
set sashelp.class;
x=age;
height=age*x;
run;

data _null_;
infile "%sysfunc(pathname(work))/myview.sas7bvew";
input;
put _infile_;
run;

在日志中提供以下内容:

enter image description here

答案 3 :(得分:1)

DESCRIBE; 
Without Arguments 

Use the DESCRIBE statement to retrieve program source code from a stored compiled DATA step program or a DATA step view. SAS writes the source statements to the SAS log. 

25   data v / view=v;
26      set sashelp.class;
27      if sex eq 'F';
28      run;

NOTE: DATA STEP view saved on file WORK.V.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


29
30   data view=v;
31      describe;
32      run;

NOTE: DATA step view WORK.V is defined as:

data v / view=v;
   set sashelp.class;
   if sex eq 'F';
run;
相关问题