2011年回顾
好久没有更新博客了,站在2012年初,对2011年回顾一下吧。 :-)
这一年大致做了下面几件事:
- 寒假,开始较为投入的学习SAS,并建立起现在这个博客。
- 上半年,常规学校学习的同时在方正证券(长沙)实习了近3个月,做了一些券商客户细分的研究工作。
- 6月,第四届北京R会议旁听。
- 暑假,在赛诺菲巴斯德做SAS programming的实习。
- 10月左右,参加各种校园招聘,辛苦找工作。
- 10月底,去上海参加了SAS圈子的一个聚会。
- 11月中旬到现在,在SAS R&D北京这边做Testing的实习。
- 9月到11月这期间,带着给中南统计交流协会10级讲讲SAS相关的东西。
- 这一年也找机会在张家界、北京、天津、济南、青岛、南京等转了转。
SAS9.2统计图形过程步帮助文档导读(1)
SAS自9.2版本后在作图方面有很大提高, SAS/GRAPH 9.2的基本内容可参见这里,如下图:

统计图形过程步(Statistical Graphics Procedures)是SAS 9.2中新增(相对于SAS 9.1及以前版本)的部分,这些过程步都以SG开头,包括:SGplot, SGpanel, SGscatter, SGrender, SGdesign。《Statistical Graphics Procedures Guide》即是其相关介绍。
本系列主要概览性地介绍《SAS/GRAPH 9.2: Statistical Graphics Procedures Guide, Second Edition》这一帮助文档,以期大家能对SAS 9.2统计作图过程步有个较为全面的了解,在以后使用中能快速上手。
可以在官网下载《SAS/GRAPH 9.2: Statistical Graphics Procedures Guide, Second Edition》。
下图是该帮助文档的主目录:

What’s New不介绍了,因为SAS 9.3都已经出来了,还有更新的了。下文主要对其他三个部分进行简要介绍。
Numeric precision in SAS
上周学习了点SAS数值精度方面的问题,觉得这相关内容还是很值得发掘的,自己小做了个PPT,目录如下:
1.Two aspects of numeric data in SAS
2.Floating-point (real binary)
- Floating point representation
- Concepts
- IEEE system
- A Example
3.Numeric precision: Integer
- Problem: LENGTH statement
- Reason
- Solution
4.Numeric precision: Fraction
- Problem: LENGTH statement
- Reason
- Solution
5.Other considerations
- Exception
- Formula transmutation
6.Conclusions
ppt文件:numeric precision in SAS(by hssnow)
继续阅读使用%nowpath宏获取当前SAS路径
前几天学习了一个叫mypath的宏,其实现了将当前sas程序的路径定义为一个宏变量、以方便后续调用路径的功能。查了下相关资料,在《Generating Program-Stamped Output in an Interactive SAS Session》中,也有个叫fullpath的宏,是提取当前路径为宏变量后进行应用。
个人觉得这2个实现路径提取功能的宏及其中的编程技巧挺有用的,拿出来分享一下。
1.%nowpath
1.1
将%mypath和%fullpath作了小小改动、整合成了下面的宏%nowpath
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | %macro nowpath; %global fullpath nowpath; /*定义为global,为后续调用准备*/ proc sql noprint; select xpath into : fullpath /*选取全路径*/ from dictionary.extfiles /*dictionary.extfiles包含SAS路径信息*/ where substr(fileref,4) eq ( select max(substr(fileref,4)) /*max()保证选取最新(当前)路劲*/ from dictionary.extfiles where substr(fileref,1,1) eq "#" and index(xpath,".sas") gt 0 ); quit; /*选取当前路径*/ %let nowpath=%substr(&fullpath,1,%eval(%length(&fullpath)-%length(%scan(&fullpath,-1,\)))); %put The Full Path is: &fullpath; %put The Now Path is: &nowpath; %mend nowpath; |
SAS9.2统计作图小记
参考《Statistical Graphics in SAS》,本文对SAS 9.2作图方式进行了简单的梳理。
1.主要的3种统计图形生成方式:
- 利用Output Delivery System(ODS),统计过程步直接产生统计图形。使用“ods graphics on”语句,将会直接输出统计过程步的默认图形。
- 利用SG过程步。主要包括proc sgplot,proc sgscatter,proc sgpanel三个过程步。
- 利用GTL(Graph Template Language)。主要使用proc template和proc sgrender。
2.实例:
对数据集sashelp.class中的weight关于height作一次回归拟合图。
数据如下:
继续阅读


