SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 1800|回复: 2
打印 上一主题 下一主题

有没有sas中的特殊自动系统变量的解释说明集合相关的书啊!谢谢

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2004-1-16 08:20:39 | 只看该作者

有没有sas中的特殊自动系统变量的解释说明集合相关的书啊!谢谢

有没有sas中的特殊自动系统变量的解释说明集合相关的书啊!谢谢
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2004-1-17 10:49:38 | 只看该作者
A good question!

As I know, THere is no such a book [color=red:d1e49]specially designed [/color:d1e49]on (special)automatic SAS system variables. If any of you know such a book please let me know. Thanks.

Generally speaking, this topic is too broad to give a full list. I just try to add what I know (mainly from OnlineDoc or from other source) as followed. Hope others will add their thoughts. Thanks.

If time is available I'd like to write a tech paper on it. Does any one else is interested in such a topic?

[color=blue:d1e49]A Datastep/some datastep statments
B BASE Procedures, i.e SQL
C MACROs
D AF frame development[/color:d1e49]
<MORE need to add>

Hope this helps,

Zibao

[color=red:d1e49]A. Those in data step (created automatically by the DATA step or by DATA step statements) [/color:d1e49]

These variables are added to the program data vector but are not output to the data set being created. The values of automatic variables are retained from one iteration of the DATA step to the next, rather than set to missing.

Two automatic variables are created by every DATA step: _N_ and _ERROR_.

_N_
is initially set to 1. Each time the DATA step loops past the DATA statement, the variable _N_ is incremented by 1. The value of _N_ represents the number of times the DATA step has iterated.

_ERROR_
is 0 by default but is set to 1 whenever an error is encountered, such as an input data error, a conversion error, or a math error, as in division by 0 or a floating point overflow. You can use the value of this variable to help locate errors in data records and to print an error message to the SAS log.

Automatic variables that are created by specific statements are documented with those statements. For examples, see the BY statement, the MODIFY statement, and the WINDOW statement.

And variable list names (such as _NUMERIC_, _CHARACTER_, and _ALL_).

[color=red:d1e49]B. Those from PROC SQL [/color:d1e49]

After each PROC SQL statement has executed, the following macro variables are updated with these values: &SQLOBS contains the number of rows executed by an SQL procedure statement. For example, it contains the number of rows formatted and displayed in SAS output by a SELECT statement or the number of rows deleted by a DELETE statement.

&SQLRC :
contains the following status values that indicate the success of the SQL procedure statement:
0 PROC SQL statement completed successfully with no errors.
4 PROC SQL statement encountered a situation for which it issued a warning. The statement continued to execute.
8 PROC SQL statement encountered an error. The statement stopped execution at this point.
12 PROC SQL statement encountered an internal error, indicating a bug in PROC SQL that should be reported to SAS Institute. These errors can occur
only during compile time.
16 PROC SQL statement encountered a user error. This error code is used, for example, when a subquery (that can only return a single value) evaluates to more than one row. These errors can only be detected during run time.
24 PROC SQL statement encountered a system error. This error is used, for example, if the system cannot write to a PROC SQL table because the disk is full. These errors can occur only during run time.
28 PROC SQL statement encountered an internal error, indicating a bug in PROC SQL that should be reported to SAS Institute. These errors can occur only during run time.

&SQLOOPS :
contains the number of iterations that the inner loop of PROC SQL executes. The number of iterations increases proportionally with the complexity of the query. See also the description of the LOOPS option .

&SQLXRC :
contains the DBMS-specific return code that is returned by the Pass-Through Facility.

&SQLXMSG :
contains descriptive information and the DBMS-specific return code for the error that is returned by the Pass-Through Facility."

[color=red:d1e49]C. Automatic Macro Variables [/color:d1e49]

Automatic macro variables are created by the macro processor and they supply a variety of information. They are useful in programs, for example to check the status of a condition before executing code. When you use automatic macro variables, you reference them the same way that you do macro variables that you create, for example &SYSLAST or &SYSJOBID.

A not-complete list:
SYSBUFFR receives text entered in response to a %INPUT statement that the macro processor cannot match with any variable in the statement.
SYSCMD contains the last command from the command line of a macro window that was not recognized by display manager.* SYSDATE gives date the job started execution in DATE6. or DATE7. format.*
SYSDAY gives the day of week the job or session started execution.*
SYSDEVIC gives the name of the current graphics device.
SYSDSN gives the name of the most recently created SAS data set.
SYSENV returns FORE if the SAS program was entered from the keyboard. If input does not come from the keyboard, or if the macro executes in noninteractive mode, the value is BACK.*
SYSERR contains the return code set by SAS procedures. Values are:
0 execution completed successfully.
1 execution cancelled by user with a RUN CANCEL statement.
2 execution cancelled by user with an ATTN or BREAK command.
4 execution completed successfully but with warning messages.
>4 an error occurred.
SYSINDEX gives the number of macros that have started execution in the current SAS job or session.*
SYSINFO contains return code information provided by some SAS procedures.
SYSJOBID gives the name of the currently executing batch job. The value and behavior is system dependent. Please refer to the SAS documentation for your operating system.
SYSLAST gives the name of the most recently created SAS data set.
SYSLIBRC contains return code from LIBNAME statement.
SYSMENV gives currently active macro execution environment.* Values:
S macro was part of the SAS program
D macro was invoked from display manager or full-screen procedure command line.
SYSMSG contains a message to be displayed in the message area of a macro window.
SYSPARM returns the same string as that returned by the DATA step function SYSPARM().
SYSPBUFF receives all text supplied as macro parameter values in the macro call.
SYSSCP returns the abbreviation for the operating system being used.*
SYSRC contains return code from X statement, X command, or any other operating-system command.
SYSTIME gives the time the job started execution (hh:mm).*
SYSVER gives the version of SAS software you are using.* *indicates that the variable is read-only.
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
板凳
 楼主| 发表于 2004-1-17 16:48:23 | 只看该作者

thanks

thanks!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2025-1-7 12:46 , Processed in 0.127043 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表