SAS 中的退出与运行语句 [英] Quit vs Run statements in SAS

查看:73
本文介绍了SAS 中的退出与运行语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SAS 中,退出"和运行"有什么区别?陈述?我无法弄清楚何时使用退出"以及何时使用运行"?例如,为什么 proc datasets 使用 quitproc contents 使用 run

In SAS, what is the difference between 'quit' and 'run'? statements? I cannot figure out when to use 'quit' and when to use 'run'? For example, why is proc datasets using quit but proc contents using run

推荐答案

这可以追溯到 SAS 曾经是大型机程序的地方(现在仍然可以!).

This dates back to where SAS used to be a mainframe program (and still can be!).

RUN; 是 SAS 运行提交语句的命令.回到较早的大型机时代,报表将一次提交一个(或分批,但这里的核心概念是每一行都与 SAS 的观点是分开的).SAS 接受语句而不做任何事情,直到它遇到 RUN; 或其他会创建步骤边界的东西(另一个 DATAPROC 行,通常).在数据步骤或非交互式过程中(例如,过程意味着 - 只能执行一组指令然后退出的过程),run 告诉它去做(无论如何)和然后回到一张白纸.

RUN; is a command for SAS to run the submitted statements. Back in the older mainframe days, statements would've been submitted to SAS one at a time (or in batches, but the core concept here is that each line is separate from SAS's point of view). SAS accepts statements without doing anything until it hits a RUN; or something else that would create a step boundary (another DATA or PROC line, usually). In a data step, or a non-interactive proc (proc means, for example - a proc that can only do one set of instructions, and then exits), run tells it to do (whatever) and then return to a blank slate.

QUIT; 用于交互式编程环境.IML、SQL、许多回归和建模 PROC、FORMAT、TEMPLATE、DATASETS 等 - 都可以交互使用,这意味着可以向它们发送一组以上的指令.

QUIT; is used in interactive programming environments. IML, SQL, many of the regression and modelling PROCs, FORMAT, TEMPLATE, DATASETS, etc. - all can be used interactively, meaning, more than one set of instructions can be sent to them.

在这些交互式案例中,您希望 SAS 继续运行一些指令,但仍保持该 PROC 的环境打开 - 例如,您的下一条语句将在同一个 PROC 中.其中一些立即运行 - PROC SQL 是一个很好的例子 - 而一些(特别是建模 PROC) RUN; 做了一些事情(告诉它到目前为止运行模型) 但它不会退出 proc,直到遇到 QUIT; (或另一个需要它退出的步骤边界,即 data/proc 语句).这些被称为运行组",而运行组处理"是您将看到的与之相关的术语.

In these interactive cases, you want SAS to go ahead and run some of the instructions, but still keep that PROC's environment open - your next statement would be in the same PROC, for example. Some of those run immediately - PROC SQL is a good example of this - while some (particularly the modelling PROCs) RUN; does something (tells it to run the model so far) but it won't exit the proc until QUIT; is encountered (or another step boundary that requires it to exit, i.e. a data/proc statement). These are called "run groups", and "run group processing" is the term you'll see associated with that.

你会发现有些人把跑了;quit;run;quit; 可能合适的每一点;这不会伤害任何东西,尽管它也不是真的正确".在某些情况下需要这样做!

You will find that some people put run; quit; at every point that run; or quit; might be appropriate; that doesn't hurt anything, though it isn't really 'right', either. And there are some cases where it's needed to do that!

一个例子:

/* first run group*/
proc gplot data=sales;
   title1 "Sales Summary";
   plot sales*model_a;
run;

      /* second run group */
   plot sales*model_b;
run;
quit;

(来自 运行组处理 )

这篇关于SAS 中的退出与运行语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆