[英]Run SAS Program (Inside the SAS project) with lines of code
I'm trying to automate my SAS code.我正在尝试自动化我的 SAS 代码。 In a project i have several programs, and i would like to have one program that can call some of the previous ones.
在一个项目中,我有几个程序,我希望有一个程序可以调用之前的一些程序。 The ideia is to make a condition that when true call a specific program.
ideia 是设置一个条件,当 true 调用特定程序时。
You can use call execute
in DATA step to dispatch the code to run a program.您可以在 DATA 步骤中使用
call execute
来调度代码以运行程序。
Suppose you have a control table listing the programs that are available to run:假设您有一个控制表,列出了可以运行的程序:
PERM.PROGRAMS
-------------
runit program
----- -------------------------------------
yes /project1/step1.sas
no /project1/step1extra.sas
yes /project1/step2.sas
data _null_;
set perm.programs;
if runit='yes' then
call execute ('%include ' || quote(program,"'"));
run;
You need a control program.您需要一个控制程序。 Assuming you're working on SAS 9.4M5+ you can also use %IF/%THEN in open code.
假设您正在使用 SAS 9.4M5+,您还可以在开放代码中使用 %IF/%THEN。
%INCLUDE will run a program, just need to provide the path. %INCLUDE 会运行一个程序,只需要提供路径。
%let condition= TRUE;
%if condition == TRUE %then %do;
%include 'path to sas program.sas';
%end;
%include 'path to sas program2.sas';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.