博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
sas中的sql(8)sql选项解析,数据字典
阅读量:7113 次
发布时间:2019-06-28

本文共 2725 字,大约阅读时间需要 9 分钟。

 1:Proc sql中的选项

 1.1:INOBS/OUTOBS=

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

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

 

1.2:NUMBER/NONUMBER

效果如下

 

1.3:Double/NoDouble

Double Spacing your output to make it easier to read.

 1.4: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之间

 

1.5:STIMER | NOSTIMER

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

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

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

 1.6: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;

 

2:数据字典

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.Columns table contains information (such as name, type, length, and format) about all columns

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

dictionary tables只能通过sql访问,表或视图都行

 

使用数据字典

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='SASUSER'and name='EmpID';

 

转载于:https://www.cnblogs.com/yican/p/4105807.html

你可能感兴趣的文章
Thinkphp中eq,neq,gt,lt等表达式缩写
查看>>
开机就出现GRUB> 进不了系统?
查看>>
Windows Server 2008 R2 实现通过WEB方式修改域账号密码
查看>>
kvm--初步认识
查看>>
我的友情链接
查看>>
pacemaker搭建HTTP集群
查看>>
Linux时间同步
查看>>
我的友情链接
查看>>
我的友情链接
查看>>
PHP获取目标路径的文件目录
查看>>
Teechart数据库图表介绍
查看>>
LNMP笔记:域名重定向、读写权限、显示WP主题、北京时间
查看>>
List of MIME Types by Content Type
查看>>
001—玩转Mysql的配置文件(my.ini)
查看>>
Crunch Bang配置Conky系统监视工具
查看>>
VR、AR與MR的區別
查看>>
大数 进制转换 10-16
查看>>
Windows 应用生态系统 (2)
查看>>
poj3624 0-1背包模板
查看>>
第四次作业
查看>>