首页 > 代码库 > sas中的sql(8)sql选项解析,数据字典

sas中的sql(8)sql选项解析,数据字典

 

 

INOBS/OUTOBS=

这个选项意思在前面的随笔中已说过,就INOBS这里有个例子

这里的INOBS=5是针对于两张表分别读入5个,而不是一共读入五个

 

NUMBER/NONUMBER

效果如下

 

Double/NoDouble

Double Spacing your output to make it easier to read.

 

FLOW | NOFLOW | FLOW=n | FLOW=n m

The FLOW option causes text to be flowed in its column instead of wrapping the entire row

n sets the width of the flowed column

n m使得列的宽度在n - m之间

 

STIMER | NOSTIMER

NOSTIMER为默认,当为默认时效果如下

两个select语句的运行时间被一起计算,没有起到比较的效果

使用STIMER后,起到了比较的效果

 

Resetting Options

You can use the RESET statement to add, drop, or change PROC SQL options without reinvoking the SQL procedure.

添加

proc sql outobs=5;select flightnumber, destinationfrom sasuser.internationalflights;reset number;select flightnumber, destinationfrom sasuser.internationalflightswhere boarded gt 200;quit;

删除

proc sql number;select name, address, city, state, zipcodefrom sasuser.frequentflyers;reset nonumber;select name, address, city, state, zipcodefrom sasuser.frequentflyerswhere pointsearned gt 7000and pointsused lt 3000;quit;

 

数据字典

Dictionary tables are special, read-only SAS tables that contain information about SAS data libraries, SAS macros, and external files that are in use or available in the current SAS session.
Dictionary tables also contain the settings for SAS system options and SAS titles and footnotes that are currently in effect

Dictionary table by referring to the PROC SQL view of the table that is stored in the Sashelp library.

 

使用数据字典

proc sql;    describe table dictionary.tables;quit;
/*这里是一部分关于表的描述信息*/
create
table DICTIONARY.TABLES ( libname char(8) label=Library Name, memname char(32) label=Member Name, memtype char(8) label=Member Type, dbms_memtype char(32) label=DBMS Member Type, memlabel char(256) label=Data Set Label, typemem char(8) label=Data Set Type, crdate num format=DATETIME informat=DATETIME label=Date Created, modate num format=DATETIME informat=DATETIME label=Date Modified, nobs num label=Number of Physical Observations, obslen num label=Observation Length, nvar num label=Number of Variables, protect char(3) label=Type of Password Protection, compress char(8) label=Compression Routine, encrypt char(8) label=Encryption,
.......
);
/*我们选择库SASUSER中的所有表,以及他们的观测值数量,变量数,和建表日期等变量*/
proc
sql;select memname format=$20., nobs, nvar, crdatefrom dictionary.tableswhere libname=SASUSER;
/*查询SASUSER库中含有列EmpID的所有表名*/
proc
sql;select memnamefrom dictionary.columnswhere libname=SASUSERand name=EmpID;

 

sas中的sql(8)sql选项解析,数据字典