<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>技止于此 &#187; SAS</title>
	<atom:link href="http://www.jiangtanghu.com/cn/category/sas/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jiangtanghu.com/cn</link>
	<description>胡江堂：（所谓）技术博客</description>
	<lastBuildDate>Wed, 26 Oct 2011 13:16:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>北大讲座（20111028）：SAS编程与生物统计</title>
		<link>http://www.jiangtanghu.com/cn/2011/10/26/sas-pku/</link>
		<comments>http://www.jiangtanghu.com/cn/2011/10/26/sas-pku/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 13:16:19 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2011/10/26/sas-pku/</guid>
		<description><![CDATA[这个周五，我会跟同事（SAS程序员和生物统计师）一起去北大做个关于SAS编程与生物统计的经验交流，感兴趣的朋友不妨去转转。这个活动由我以前在学校的社团，北大应用统计研究会帮忙张罗。之前我在协会负责SAS俱乐部。
主题（关键字）：SAS编程、生物统计、行业应用
时间：2011年10月28号，周五，晚上，7点到9点
地点：北京大学，二教422（地铁北大东门下就是）
适用人群：对SAS与生物统计感兴趣的在校生，其他感兴趣的朋友也欢迎捧场
组织单位：北京大学应用统计研究会
出席人员：来自赛诺菲巴斯德(Sanofi Pasteur)生物统计中国部的SAS程序员与生物统计师

这将是一场非正规的经验交流（赶在这个校园招聘忙的季节），但我们也抱着接触潜在实习生与员工的想法。对我个人来说，就是趁着机会，回次学校，见见朋友，再体会一把久违的社团生活。
又，如果你是在校生，先读一下这篇文章会很有作用：
http://cos.name/2010/04/think-sas-1/

]]></description>
			<content:encoded><![CDATA[<p>这个周五，我会跟同事（SAS程序员和生物统计师）一起去北大做个关于SAS编程与生物统计的经验交流，感兴趣的朋友不妨去转转。这个活动由我以前在学校的社团，<a href="http://10928.u.giftsplay.com/news/2967.html" target="_blank">北大应用统计研究会</a>帮忙张罗。之前我在协会负责SAS俱乐部。</p>
<blockquote><p><strong>主题（关键字）：SAS编程、生物统计、行业应用</strong></p>
<p><strong>时间：2011年10月28号，周五，晚上，7点到9点</strong></p>
<p><strong>地点：北京大学，二教422（地铁北大东门下就是）</strong></p>
<p><strong>适用人群：对SAS与生物统计感兴趣的在校生，其他感兴趣的朋友也欢迎捧场</strong></p>
<p><strong>组织单位：北京大学应用统计研究会</strong></p>
<p><strong>出席人员：来自赛诺菲巴斯德(</strong><a href="www.sanofipasteur.com" target="_blank"><strong>Sanofi Pasteur</strong></a><strong>)生物统计中国部的SAS程序员与生物统计师</strong></p>
</blockquote>
<p>这将是一场非正规的经验交流（赶在这个校园招聘忙的季节），但我们也抱着接触潜在实习生与员工的想法。对我个人来说，就是趁着机会，回次学校，见见朋友，再体会一把久违的社团生活。</p>
<p>又，如果你是在校生，先读一下这篇文章会很有作用：</p>
<blockquote><p><a href="http://cos.name/2010/04/think-sas-1/">http://cos.name/2010/04/think-sas-1/</a></p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2011/10/26/sas-pku/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>更新（技术与工作，2011-10-04）</title>
		<link>http://www.jiangtanghu.com/cn/2011/10/05/update/</link>
		<comments>http://www.jiangtanghu.com/cn/2011/10/05/update/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 04:39:48 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[CDISC]]></category>
		<category><![CDATA[SAS]]></category>
		<category><![CDATA[人物]]></category>
		<category><![CDATA[机器学习与数据挖掘]]></category>
		<category><![CDATA[统计备忘录]]></category>
		<category><![CDATA[胡说]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[数据挖掘]]></category>
		<category><![CDATA[统计]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2011/10/05/update/</guid>
		<description><![CDATA[大半年没跟新了。一些个人技术方面的动向在英文博客里：
1.&#160; CDISC Express
CDISC Express是一款开源的SDTM转化器，基于SAS和Excel（其实背后是XML）。我为这个产品写了一系列的入门教程，并参加了一个相应的比赛（赢了一台iPad）。益辉最近也抽中了一台Kindle，加上上半年在SAS Global Forum拎回来的一台Kindle,不禁感慨，知识（和概率）真是咱农民的第一生产力呀。对着手头这台上世纪的诺基亚6300，我坚定的目光瞄上了iPhone5。有一句话说，做自己喜欢的事，然后找一个人或机构买单，人生一乐也。
又，把临床数据自动导入到符合CDISC标准的数据集，现在有不少vendor在做，很多药厂内部也有开发。感兴趣的朋友不妨也鼓捣鼓捣。
2. Big Data
现在还提这个概念就较不时尚了，重要的是如何做，或者如何为以后做些准备。SAS也将加入对Hadoop的支持，不过现在Hadoop的框架还是基于Java，拣回来些C/C++、Java或者Python还是很有戏场的（甚至R也能够玩会Hapoop），对一个SAS程序员来说，是时候更新自个的工具箱了。
迄今为止，这个领域还是IT人士的天下。这一方面说明了我们这些传统的数据分析人员还需要夯实技术（去看看Hadoop的‘hello world’, 所有的操作都要分解为map()和reduce(),而这并不是所有人都习惯的），也说明目前这一块，发展还在起步阶段，因为这些框架，最终都是要为了让数据产生价值，而这就不可能有数据分析师的缺席。 
3. SAS之外
这些日子，在SAS之外，试图拣回来些数据挖掘的东西。本来准备四月份在拉斯维加考下SAS数据挖掘的认证，后来还是被其他事情给挪掉了。最后所得就是，还是稍微看了下这块的东西，在概念上是过了一遍。这次在拉斯维加，碰到以前在北大一起做SAS俱乐部的朋友光辉，他现在加拿大工作。光辉说他趁着开会的缝隙，随手把SAS的数据挖掘认证（SAS Certified Predictive Modeler using SAS Enterprise Miner 5 or 6 Credential）给考了。这叫行动力啊。
机缘巧合，这上半年有朋友给我介绍Feature Selection（大白话就叫变量选择，在数据挖掘里面属于前期的工作），我就对着一个R的包看了一遍，也就是在脑袋里过一下，最后没有什么成果出来。另一个额外的好处是，这次我是对R在学习方面的优势有了切身体验，对R算是有了些个人感情。一边找论文看，然后几乎就能找到一个相应的R包跑一跑，增加些手感，这效果真是不错。
再说些R。我还真尝试过认真学一学R。做为一个SAS程序员，想，还是从input/output开始吧，就先研读官方文档R Data Import/Export，转了一圈，发现，这数据读取转存还是SAS更为方便有效，对我来说，鼓捣这个有点得不偿失，遂罢。
又想，R对SAS的一个优势在于它支持多种数据结构，像array、list之类，就从这入手了。不知道怎么搞的，在学习R的数据结构时，可能是我学习不够深入，修为不够，总觉得有些不够畅快——具体我说不上来。想，我还是把自己的Python拣回来吧，R跟Python有类似的地方。后来我就能说上来了，Python的List等数据结构，对我来说，的确是更为优雅（换一种说法，或者是因为我还没有读到一本“优雅地”介绍R数据结果的文档）。好吧，到此为止，我的R还停留在用它尝试算法的阶段。
然后就是捡回Python。我两年多的SAS程序员工作经历，一个直接的后果就是把之前学过的一点C++、Java和Python又打回“hello world”的水平，手都生疏了。我读了很多Jian Dai（他在加州做SAS程序员）的代码，包括Perl, C, JavaSAcript等等，想，做SAS程序员也不至于把其他的语言都丢掉，为了方便，又重新学习下Python。
为学而学毕竟有局限，在工作中使用当然来得最快。现在我还没有这机会，除了翻文档之外，就尝试用Python写些小东西，把它就当一回事一样。其实，除了工作中直接使用，还有一项就是参加开源运动——我看益辉这几年写R代码是风生水起，一个极大的外部刺激就是参与开源运动，整个积极性都给起来了。一个普通的统计学博士生，用不了那个多的代码量，那动力，就在于统计之外。
统计。今年的基础统计学习，没有去年那么饱满。每天跟统计师打交道，就想好好学习一下他们的语言。今年，到现在为止，算是在工作中（向统计师）学习，整了下CI calculation和euivalence and noninferiority test。下一步准备鼓捣些Sample Size之类。有个哥们写了一篇文章叫Programmers Need To Learn Statistics Or I Will Kill Them All，好吧，作为一个程序员，为了生命安全，每天跟统计师打交道，还是学下统计了。
4. 工作
不是说自己的工作，是说工作与实习机会。感兴趣的朋友，不妨跟我联系。中南大学统计系的本科生韩帅，不久前结束在我公司的实习，在Sxlion主持的SAS中文门户写了两篇非常有价值的总结文章，大伙可以去看看：
一个SAS菜鸟的故事 学习篇
一个SAS菜鸟的故事 实习篇

人是这样的，只有经历过了（我说的是第一份实习或其他），才能自信地自称“菜鸟”，否则就真是论坛里“弱弱地问”的菜鸟。我推荐我公司，当然是因为最熟悉。说实在的，在北京，在药厂，对SAS程序员来说，这的确是一份不错的的实习机会。去年我也推荐了汤耀华来我公司做实习生，他现在中科院读研。这两位都来自中南大学，怎么说？对我和我的同事来说，他们提升了中南大学在我们心目中的分量。在上海，我想，很多SAS程序员对中南大学也很有兴趣。
一些大学生朋友给我写邮件打电话，说些职业或技术选择的事。这不是选择两个到手的offer，大哥，随便扎进一个方向，都比在那犹豫强。
5. SAS
还是得提一下SAS。现在用上SAS9.2了（然后SAS9.3就华丽丽地发布了。。。），对我来说，直接地，有两个触动：
1）SAS9.2及以后，作图更漂亮，我终于有些动力研究下SAS作图了。在公司，去年与宾州的同事一道，把公司作图的macro（基于9.1.3）的更新以后，以后都直接调用，压根就没写过proc gplot之类，然后我就发现自己作图的那一点点手艺正在迅速凋零。。。
2）SAS9.2中，BASE中正式支持自定义函数（仿佛听到其他门类的程序员在冷笑，我弱弱地辩解一下，SAS/IML早就可以自定义函数，而且对SAS程序员来讲，一直使用macro写一种叫function-like macro，而且，macro也支持递归。。。）。这将给我们的编程生活带来不少乐趣，其中之一就是可以把以前的一些macro改写成函数（方便debug啊）。
在写函数之前，我把SAS BASE里面的函数都看了一遍，省得以后重复造轮子：
 
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
把所有的函数分门别类导入到Excel，然后动用一点VBA，把每个函数的解释都搁进每个函数名的comments里。这么一梳理，又发现不少有趣的东西，再议。
]]></description>
			<content:encoded><![CDATA[<p>大半年没跟新了。一些个人技术方面的动向在英文博客里：</p>
<p>1.&#160; <a href="http://www.jiangtanghu.com/blog/category/cdisc/" target="_blank">CDISC Express</a></p>
<p>CDISC Express是一款开源的SDTM转化器，基于SAS和Excel（其实背后是XML）。我为这个产品写了一系列的入门教程，并参加了一个相应的比赛（<a href="http://blog.clinovo.com/and-the-winner-is/" target="_blank">赢了一台iPad</a>）。<a href="http://yihui.name/cn/2011/09/ny-strata-and-nj-att/" target="_blank">益辉最近也抽中了一台Kindle</a>，加上上半年<a href="http://li-and-jiang.com/blog/2011/04/06/sasgf11/" target="_blank">在SAS Global Forum拎回来的一台Kindle</a>,不禁感慨，知识（和概率）真是咱农民的第一生产力呀。对着手头这台上世纪的诺基亚6300，我坚定的目光瞄上了iPhone5。有一句话说，做自己喜欢的事，然后找一个人或机构买单，人生一乐也。</p>
<p>又，把临床数据自动导入到符合CDISC标准的数据集，现在有不少vendor在做，很多药厂内部也有开发。感兴趣的朋友不妨也鼓捣鼓捣。</p>
<p>2. <a href="http://www.jiangtanghu.com/blog/2011/10/04/map-and-reduce-in-mapreduce-a-sas-illustration/" target="_blank">Big</a> <a href="http://www.jiangtanghu.com/blog/2011/09/14/analytical-valley/" target="_blank">Data</a></p>
<p>现在还提这个概念就较不时尚了，重要的是如何做，或者如何为以后做些准备。<a href="blogs.sas.com/content/datamanagement/2011/08/29/sas-hadoop-and-big-data" target="_blank">SAS也将加入对Hadoop的支持</a>，不过现在Hadoop的框架还是基于Java，拣回来些C/C++、Java或者Python还是很有戏场的（甚至R也能够玩会Hapoop），对一个SAS程序员来说，是时候更新自个的工具箱了。</p>
<p>迄今为止，这个领域还是IT人士的天下。这一方面说明了我们这些传统的数据分析人员还需要夯实技术（去看看<a href="http://hadoop.apache.org/common/docs/r0.17.2/mapred_tutorial.html" target="_blank">Hadoop的‘hello world’</a>, 所有的操作都要分解为<a href="http://www.jiangtanghu.com/blog/2011/10/04/map-and-reduce-in-mapreduce-a-sas-illustration/" target="_blank">map()和reduce()</a>,而这并不是所有人都习惯的），也说明目前这一块，发展还在起步阶段，因为这些框架，最终都是要为了让数据产生价值，而这就不可能有数据分析师的缺席。 </p>
<p>3. SAS之外</p>
<p>这些日子，在SAS之外，试图拣回来些<font color="#ff0000">数据挖掘</font>的东西。本来准备四月份在拉斯维加考下SAS数据挖掘的认证，后来还是被其他事情给挪掉了。最后所得就是，还是稍微看了下这块的东西，在概念上是过了一遍。这次在拉斯维加，碰到以前在北大一起做SAS俱乐部的朋友光辉，他现在加拿大工作。光辉说他趁着开会的缝隙，随手把SAS的数据挖掘认证（<a href="http://support.sas.com/certify/creds/dm.html" target="_blank">SAS Certified Predictive Modeler using SAS Enterprise Miner 5 or 6 Credential</a>）给考了。这叫行动力啊。</p>
<p>机缘巧合，这上半年有朋友给我介绍<font color="#ff0000">Feature Selection</font>（大白话就叫变量选择，在数据挖掘里面属于前期的工作），我就<a href="http://www.jiangtanghu.com/blog/2011/01/15/feature-selection-collections-for-self-study/" target="_blank">对着一个R的包看了一遍</a>，也就是在脑袋里过一下，最后没有什么成果出来。另一个额外的好处是，这次我是对R在学习方面的优势有了切身体验，对R算是有了些个人感情。一边找论文看，然后几乎就能找到一个相应的R包跑一跑，增加些手感，这效果真是不错。</p>
<p>再说些<font color="#ff0000">R</font>。我还真尝试过认真学一学R。做为一个SAS程序员，想，还是从input/output开始吧，就先研读官方文档<em>R Data Import/Export</em>，转了一圈，发现，这数据读取转存还是SAS更为方便有效，对我来说，鼓捣这个有点得不偿失，遂罢。</p>
<p>又想，R对SAS的一个优势在于它支持多种数据结构，像array、list之类，就从这入手了。不知道怎么搞的，在学习R的数据结构时，可能是我学习不够深入，修为不够，总觉得有些不够畅快——具体我说不上来。想，我还是把自己的Python拣回来吧，R跟Python有类似的地方。后来我就能说上来了，Python的List等数据结构，对我来说，的确是更为优雅（换一种说法，或者是因为我还没有读到一本“优雅地”介绍R数据结果的文档）。好吧，到此为止，我的R还停留在用它尝试算法的阶段。</p>
<p>然后就是捡回<font color="#ff0000">Python</font>。我两年多的SAS程序员工作经历，一个直接的后果就是把之前学过的一点C++、Java和Python又打回“hello world”的水平，手都生疏了。我读了很多<a href="http://www.jiangtanghu.com/blog/2011/08/15/sas-bloggers-in-action-2-jian-dai-and-his-sas-academy/" target="_blank">Jian Dai（他在加州做SAS程序员）的代码</a>，包括Perl, C, JavaSAcript等等，想，做SAS程序员也不至于把其他的语言都丢掉，为了方便，又重新学习下Python。</p>
<p>为学而学毕竟有局限，在工作中使用当然来得最快。现在我还没有这机会，除了翻文档之外，就尝试用Python写些小东西，把它就当一回事一样。其实，除了工作中直接使用，还有一项就是参加开源运动——我看<a href="http://yihui.name/en/" target="_blank">益辉</a>这几年写R代码是风生水起，一个极大的外部刺激就是参与开源运动，整个积极性都给起来了。一个普通的统计学博士生，用不了那个多的代码量，那动力，就在于统计之外。</p>
<p><font color="#ff0000">统计</font>。今年的基础统计学习，没有去年那么饱满。每天跟统计师打交道，就想好好学习一下他们的语言。今年，到现在为止，算是在工作中（向统计师）学习，整了下<a href="http://www.jiangtanghu.com/blog/2011/07/14/a-sas-implementation-of-confidence-intervals-for-single-proportion-eleven-methods/" target="_blank">CI calculation</a>和euivalence and noninferiority test。下一步准备鼓捣些Sample Size之类。有个哥们写了一篇文章叫<em><a href="http://zedshaw.com/essays/programmer_stats.html" target="_blank">Programmers Need To Learn Statistics Or I Will Kill Them All</a></em>，好吧，作为一个程序员，为了生命安全，每天跟统计师打交道，还是学下统计了。</p>
<p>4. 工作</p>
<p>不是说自己的工作，是说工作与实习机会。感兴趣的朋友，不妨跟我联系。中南大学统计系的本科生<a href="http://hssnow.name/" target="_blank">韩帅</a>，不久前结束在我公司的实习，在Sxlion主持的<a href="http://saslist.net/" target="_blank">SAS中文门户</a>写了两篇非常有价值的总结文章，大伙可以去看看：</p>
<blockquote><p><a href="http://saslist.net/archives/200" target="_blank">一个SAS菜鸟的故事 学习篇</a></p>
<p><a href="http://saslist.net/archives/202" target="_blank">一个SAS菜鸟的故事 实习篇</a></p>
</blockquote>
<p>人是这样的，只有经历过了（我说的是第一份实习或其他），才能自信地自称“菜鸟”，否则就真是论坛里“弱弱地问”的菜鸟。我推荐我公司，当然是因为最熟悉。说实在的，在北京，在药厂，对SAS程序员来说，这的确是一份不错的的实习机会。去年我也推荐了<a href="http://yaohua.cos.name/cn/" target="_blank">汤耀华</a>来我公司做实习生，他现在中科院读研。这两位都来自中南大学，怎么说？对我和我的同事来说，他们提升了中南大学在我们心目中的分量。在上海，我想，很多SAS程序员对中南大学也很有兴趣。</p>
<p>一些大学生朋友给我写邮件打电话，说些职业或技术选择的事。这不是选择两个到手的offer，大哥，随便扎进一个方向，都比在那犹豫强。</p>
<p>5. SAS</p>
<p>还是得提一下SAS。现在用上SAS9.2了（然后SAS9.3就华丽丽地发布了。。。），对我来说，直接地，有两个触动：</p>
<p>1）SAS9.2及以后，作图更漂亮，我终于有些动力研究下SAS作图了。在公司，去年与宾州的同事一道，把公司作图的macro（基于9.1.3）的更新以后，以后都直接调用，压根就没写过proc gplot之类，然后我就发现自己作图的那一点点手艺正在迅速凋零。。。</p>
<p>2）SAS9.2中，BASE中正式支持自定义函数（仿佛听到其他门类的程序员在冷笑，我弱弱地辩解一下，SAS/IML早就可以自定义函数，而且对SAS程序员来讲，一直使用macro写一种叫function-like macro，而且，macro也支持递归。。。）。这将给我们的编程生活带来不少乐趣，其中之一就是可以把以前的一些macro改写成函数（方便debug啊）。</p>
<p>在写函数之前，我把SAS BASE里面的函数都看了一遍，省得以后重复造轮子：</p>
<p><a href="http://www.jiangtanghu.com/cn/wp-content/uploads/2011/10/SAS_Func.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="SAS_Func" border="0" alt="SAS_Func" align="left" src="http://www.jiangtanghu.com/cn/wp-content/uploads/2011/10/SAS_Func_thumb.png" width="416" height="229" /></a> </p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>把所有的函数分门别类导入到Excel，然后动用一点VBA，把每个函数的解释都搁进每个函数名的comments里。这么一梳理，又发现不少有趣的东西，再议。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2011/10/05/update/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SAS: 追星篇</title>
		<link>http://www.jiangtanghu.com/cn/2011/05/20/sas-gurus/</link>
		<comments>http://www.jiangtanghu.com/cn/2011/05/20/sas-gurus/#comments</comments>
		<pubDate>Thu, 19 May 2011 18:26:54 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[人物]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2011/05/20/sas-%e8%bf%bd%e6%98%9f%e7%af%87/</guid>
		<description><![CDATA[对SAS，这套软件，这家公司，还有这套软件这家公司后面的人，我都带着很浓重的个人感情。现在，可以自豪地宣布，我完成了人生一个的小小心愿，参观了SAS总部，还有就是当面见到了SAS公司1976年的三个创始人：
 
第一个Anthony James(Jim) Barr，更多地被称为Tony，SAS系统的发明人，今年4月份在佛罗里达拜访他并长谈（右一）：
&#160;
Jim Goodnight和John Sall，现在SAS公司的一、二号当家，在拉斯维加斯的SAS全球大会见到。我没有跟Jim Goodnight有任何互动，最“近”的一次是几年前，当时在SAS中国研发中心，收到唯一一份来自Goodnight的邮件，大概是群发给全球一万多号员工的。John Sall来过北京，不过没机会见过。这次在拉斯维加，在一间中型会议室，看他慢慢演示JMP，差点超时。
第四个创始人Jane负责文档，还没有见过。不过去年，就在北京，有幸见过第一本SAS user guide (A User&#8217;s Guide to the Statistical Analysis System, 1972)的作者，Dr. Jolayne (‘Jo’) Service(左二):
&#160;
Jo离开北京后，还随着美国统计学代表团参加了上海生物统计学术论坛（SBF）组织的活动。
]]></description>
			<content:encoded><![CDATA[<p>对SAS，这套软件，这家公司，还有这套软件这家公司后面的人，我都带着很浓重的个人感情。现在，可以自豪地宣布，我完成了人生一个的小小心愿，参观了SAS总部，还有就是当面见到了SAS公司1976年的<a href="http://li-and-jiang.com/blog/2010/01/24/sas/" target="_blank">三个创始人</a>：</p>
<p><a href="http://www.jiangtanghu.com/cn/wp-content/uploads/2011/05/4J_SAS.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="4J_SAS" border="0" alt="4J_SAS" src="http://www.jiangtanghu.com/cn/wp-content/uploads/2011/05/4J_SAS_thumb.png" width="450" height="149" /></a> </p>
<p>第一个Anthony James(Jim) Barr，更多地被称为Tony，SAS系统的发明人，今年4月份在佛罗里达拜访他并长谈（右一）：</p>
<p><a href="http://www.jiangtanghu.com/cn/wp-content/uploads/2011/05/Tony.jpg"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Tony" border="0" alt="Tony" src="http://www.jiangtanghu.com/cn/wp-content/uploads/2011/05/Tony_thumb.jpg" width="329" height="248" /></a>&#160;</p>
<p>Jim Goodnight和John Sall，现在SAS公司的一、二号当家，在拉斯维加斯的S<a href="http://li-and-jiang.com/blog/2011/04/06/sasgf11/" target="_blank">AS全球大会</a>见到。我没有跟Jim Goodnight有任何互动，最“近”的一次是几年前，当时在SAS中国研发中心，收到唯一一份来自Goodnight的邮件，大概是群发给全球一万多号员工的。John Sall来过北京，不过没机会见过。这次在拉斯维加，在一间中型会议室，看他慢慢演示JMP，差点超时。</p>
<p>第四个创始人Jane负责文档，还没有见过。不过去年，就在北京，有幸见过第一本SAS user guide (<i>A User&#8217;s Guide to the Statistical Analysis System, </i>1972)的作者，Dr. Jolayne (‘Jo’) Service(左二):</p>
<p><a href="http://www.jiangtanghu.com/cn/wp-content/uploads/2011/05/Jo.jpg"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Jo" border="0" alt="Jo" src="http://www.jiangtanghu.com/cn/wp-content/uploads/2011/05/Jo_thumb.jpg" width="377" height="251" /></a>&#160;</p>
<p>Jo离开北京后，还随着美国统计学代表团参加了上海生物统计学术论坛（SBF）组织的活动。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2011/05/20/sas-gurus/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>活动两条：数据挖掘竞赛和SAS大会</title>
		<link>http://www.jiangtanghu.com/cn/2011/03/20/dm-sgf2011/</link>
		<comments>http://www.jiangtanghu.com/cn/2011/03/20/dm-sgf2011/#comments</comments>
		<pubDate>Sun, 20 Mar 2011 08:47:35 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[SGF2011]]></category>
		<category><![CDATA[数据挖掘]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2011/03/20/dm-sgf2011/</guid>
		<description><![CDATA[1.第一届全国大学生数据挖掘邀请赛
“统计之都”(http://cos.name)的朋友拉来人大统计学院和中科大管理学院，一起办一个大学生数据挖掘的比赛（“第一届全国大学生数据挖掘邀请赛”）。非在校生的朋友可能也会感兴趣，这次比赛的赞助商是上海的一家婚恋交友网站，比赛的任务是，“评估给定的候选会员集合中，哪些会员更容易获得特定会员A的青睐”。有评论认为，这是两会之后，真正关注国计民生的好题目。
预祝这次竞赛活动圆满成功。先去围观了：
http://www.statmodelingcompetition.com
http://cos.name/2011/03/1st-data-mining-competetion-for-college-students/

2. SAS Global Forum 2011, Las Vegas, Apr 4-7
SGF2011的会议论文已经放在网上，大伙可以先睹为快：
http://support.sas.com/resources/papers/proceedings11/TOC.html

这将是我第一次参加SGF。我提交的论文很水，几乎跟SAS无关，讲的是装备一个SAS程序员的几个简单的工具：文本编辑器Notepad++、文件比较工具Beyond Compare以及个人信息门户Gmail和Google Reader。
——恩？怎么还有Gmail？这话题似乎难登大雅之堂，但我觉得还是非常重要的。总体而言，SAS程序员/SAS用户的技术装备水平不高。根据SAS邮件组SAS-L订阅者邮箱使用的相关数据（http://www.howles.com/sas-l），一共有3万7千个注册邮箱，现在能跟使用者本人对应起来的邮箱数大概是4千8百个。而在这4800个可以说是较为有效的邮箱中：

.edu后缀的有722个
.net的698个
.org的198个
.gov的195个
.com的当然最多，有2680个

而在这2680个.com邮箱中，有大量分散的公司邮箱，不论，几个常用的免费邮箱是


Gmail有269个


Yahoo有252个


Hotmail有174个


这什么概念？首先，SAS用户，大量集中在企业，我猜R-help邮件组的Gmail使用者应该会非常多——当然这不是这里的重点。使用公司或机构邮箱的，大多数人用outlook之类的客户端收发邮件，其余的如Gmail、Yahoo、Hotmail用户大多使用Webmail的方式。作为一个Gmail爱好者，我好奇的是众多的非gmail用户如何管理（以及忍受）来自SAS-L成千上万的邮件的。
又，SAS-L的Gmail邮箱订阅者较少，还有一个可能，就是大伙都喜欢在工作时间收取SAS邮件。我个人推荐用Gmail收取邮件组的邮件，同样，根据个人兴趣，那天我还会跟SAS用户推荐Google Reader，这个所谓Web2.0时代的利器。这次SAS大会同样也充满2.0精神：


一个Twitter账户，#SASGF11


一个官方博客，http://blogs.sas.com/sgf/


一个Facebook账户


一个LinkedIn讨论组


一个信息门户，http://sascommunity.org/


到时热闹了。
]]></description>
			<content:encoded><![CDATA[<p><strong>1.</strong><a href="http://www.statmodelingcompetition.com/" target="_blank"><strong>第一届全国大学生数据挖掘邀请赛</strong></a></p>
<p>“统计之都”(<a href="http://cos.name">http://cos.name</a>)的朋友拉来人大统计学院和中科大管理学院，一起办一个大学生数据挖掘的比赛（“<a href="http://www.statmodelingcompetition.com/" target="_blank">第一届全国大学生数据挖掘邀请赛</a>”）。非在校生的朋友可能也会感兴趣，这次比赛的赞助商是上海的一家婚恋交友网站，比赛的任务是，“评估给定的候选会员集合中，哪些会员更容易获得特定会员A的青睐”。有评论认为，这是两会之后，真正关注国计民生的好题目。</p>
<p>预祝这次竞赛活动圆满成功。先去围观了：</p>
<blockquote><p><a href="http://www.statmodelingcompetition.com">http://www.statmodelingcompetition.com</a></p>
<p><a href="http://cos.name/2011/03/1st-data-mining-competetion-for-college-students/">http://cos.name/2011/03/1st-data-mining-competetion-for-college-students/</a></p>
</blockquote>
<p><strong>2. </strong><a href="http://support.sas.com/events/sasglobalforum/2011/" target="_blank"><strong>SAS Global Forum 2011</strong></a><strong>, Las Vegas, Apr 4-7</strong></p>
<p>SGF2011的会议论文已经放在网上，大伙可以先睹为快：</p>
<blockquote><p><a href="http://support.sas.com/resources/papers/proceedings11/TOC.html">http://support.sas.com/resources/papers/proceedings11/TOC.html</a></p>
</blockquote>
<p>这将是我<a href="http://support.sas.com/resources/papers/proceedings11/211-2011.pdf" target="_blank">第一次参加SGF</a>。<a href="http://support.sas.com/resources/papers/proceedings11/211-2011.pdf" target="_blank">我提交的论文</a>很水，几乎跟SAS无关，讲的是装备一个SAS程序员的几个简单的工具：文本编辑器Notepad++、文件比较工具Beyond Compare以及个人信息门户Gmail和Google Reader。</p>
<p>——恩？怎么还有Gmail？这话题似乎难登大雅之堂，但我觉得还是非常重要的。总体而言，SAS程序员/SAS用户的技术装备水平不高。根据SAS邮件组SAS-L订阅者邮箱使用的相关数据（<a href="http://www.howles.com/sas-l">http://www.howles.com/sas-l</a>），一共有3万7千个注册邮箱，现在能跟使用者本人对应起来的邮箱数大概是4千8百个。而在这4800个可以说是较为有效的邮箱中：</p>
<ul>
<li>.edu后缀的有722个</li>
<li>.net的698个</li>
<li>.org的198个</li>
<li>.gov的195个</li>
<li>.com的当然最多，有2680个</li>
</ul>
<p align="justify">而在这2680个.com邮箱中，有大量分散的公司邮箱，不论，几个常用的免费邮箱是</p>
<ul>
<li>
<div align="justify"><font color="#ff0000">Gmail</font>有269个</div>
</li>
<li>
<div align="justify">Yahoo有252个</div>
</li>
<li>
<div align="justify">Hotmail有174个</div>
</li>
</ul>
<p align="justify">这什么概念？首先，SAS用户，大量集中在企业，我猜R-help邮件组的Gmail使用者应该会非常多——当然这不是这里的重点。使用公司或机构邮箱的，大多数人用outlook之类的客户端收发邮件，其余的如Gmail、Yahoo、Hotmail用户大多使用Webmail的方式。作为一个Gmail爱好者，我好奇的是众多的非gmail用户如何管理（以及忍受）来自SAS-L成千上万的邮件的。</p>
<p align="justify">又，SAS-L的Gmail邮箱订阅者较少，还有一个可能，就是大伙都喜欢在工作时间收取SAS邮件。我个人推荐用Gmail收取邮件组的邮件，同样，根据个人兴趣，那天我还会跟SAS用户推荐Google Reader，这个所谓Web2.0时代的利器。这次SAS大会同样也充满2.0精神：</p>
<ul>
<li>
<div align="justify">一个Twitter账户，<a href="http://twitter.com/SASGlobalForum">#SASGF11</a></div>
</li>
<li>
<div align="justify">一个官方博客，<a href="http://blogs.sas.com/sgf/">http://blogs.sas.com/sgf/</a></div>
</li>
<li>
<div align="justify">一个<a href="www.facebook.com/SASGlobalForum" target="_blank">Facebook</a>账户</div>
</li>
<li>
<div align="justify">一个<a href="http://www.linkedin.com/groups/SAS-Global-Forum-2011-2993852" target="_blank">LinkedIn</a>讨论组</div>
</li>
<li>
<div align="justify">一个信息门户，<a href="http://sascommunity.org/">http://sascommunity.org/</a></div>
</li>
</ul>
<p>到时热闹了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2011/03/20/dm-sgf2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>年末流水帐</title>
		<link>http://www.jiangtanghu.com/cn/2010/12/30/%e5%b9%b4%e6%9c%ab%e6%b5%81%e6%b0%b4%e5%b8%90/</link>
		<comments>http://www.jiangtanghu.com/cn/2010/12/30/%e5%b9%b4%e6%9c%ab%e6%b5%81%e6%b0%b4%e5%b8%90/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 09:06:17 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[SGF2011]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2010/12/30/%e5%b9%b4%e6%9c%ab%e6%b5%81%e6%b0%b4%e5%b8%90/</guid>
		<description><![CDATA[首先是oloolo同学在my.sas论坛问我以前那个Think SAS 系列继不继续。话说我有很多标记为“（一）”的文章没有继续下去，长此以往，国将不国，不好不好。趁着年假，把早就搁在机器的草稿拎出来，再推进了五六千字，《Think SAS》（二）：
http://cos.name/2010/12/think-sas-2/

感兴趣的朋友不妨去拍拍砖。还没写完，这个系列。
另外，我有一篇文章被明年的SAS全球论坛(SGF2011, April4-7, Las Vegas)接受，题目很大，叫做Work Smarter than Harder-tools for growing up a SAS programmer,写的是装备SAS程序员的一些普通工具。卑之无甚高论，但现实中一般SAS程序员的装备还是挺落后的，大都拿“分析员”而不是“程序员”的标准要求自个。这篇文章草稿在
http://jiangtanghu.com/docs/en/SGF2011_JiangtangHU(draft).pdf
一样欢迎大伙拍砖评论。
明年去拉斯维加斯，心里又不禁嘀咕，倒是可以趁着这个机会把SAS数据挖掘的认证考下来。这样这几个月就又有得东西忙了。
明年准备数据挖掘，但今年开始的统计学基础还不能丢。还想给“统计之都”写些类似“方差分析初步”之类的文字。统计学我的底子高深不了，就沉浸在表达这块了。
大伙新年愉快。
]]></description>
			<content:encoded><![CDATA[<p>首先是<a href="http://sas-programming.blogspot.com" target="_blank">oloolo</a>同学在<a href="http://www.mysas.net/forum/viewtopic.php?f=8&amp;t=7201" target="_blank">my.sas</a>论坛问我以前那个<a href="http://cos.name/2010/04/think-sas-1/" target="_blank"><em>Think SAS</em></a> 系列继不继续。话说我有很多标记为“（一）”的文章没有继续下去，长此以往，国将不国，不好不好。趁着年假，把早就搁在机器的草稿拎出来，再推进了五六千字，《Think SAS》（二）：</p>
<blockquote><p><a href="http://cos.name/2010/12/think-sas-2/">http://cos.name/2010/12/think-sas-2/</a></p>
</blockquote>
<p>感兴趣的朋友不妨去拍拍砖。还没写完，这个系列。</p>
<p>另外，我有<a href="http://sgf2011.confnav.com/sgf2011/web/sessions/detail.html?id=20101023091009653775000000" target="_blank">一篇文章</a>被明年的SAS全球论坛(SGF2011, April4-7, Las Vegas)接受，题目很大，叫做<em>Work Smarter than Harder-tools for growing up a SAS programmer</em>,写的是装备SAS程序员的一些普通工具。卑之无甚高论，但现实中一般SAS程序员的装备还是挺落后的，大都拿“分析员”而不是“程序员”的标准要求自个。这篇文章草稿在</p>
<p><a title="http://jiangtanghu.com/docs/en/SGF2011_JiangtangHU(draft).pdf" href="http://jiangtanghu.com/docs/en/SGF2011_JiangtangHU(draft).pdf">http://jiangtanghu.com/docs/en/SGF2011_JiangtangHU(draft).pdf</a></p>
<p>一样欢迎大伙拍砖评论。</p>
<p>明年去拉斯维加斯，心里又不禁嘀咕，倒是可以趁着这个机会把SAS数据挖掘的认证考下来。这样这几个月就又有得东西忙了。</p>
<p>明年准备数据挖掘，但今年开始的统计学基础还不能丢。还想给“统计之都”写些类似“方差分析初步”<a href="http://sgf2011.confnav.com/sgf2011/web/sessions/detail.html?id=20101023091009653775000000" target="_blank">之类的文字</a>。统计学我的底子高深不了，就沉浸在表达这块了。</p>
<p>大伙新年愉快。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2010/12/30/%e5%b9%b4%e6%9c%ab%e6%b5%81%e6%b0%b4%e5%b8%90/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PhD in Statistics Needed: SAS R&amp;D China</title>
		<link>http://www.jiangtanghu.com/cn/2010/11/23/statistics-phd-sas/</link>
		<comments>http://www.jiangtanghu.com/cn/2010/11/23/statistics-phd-sas/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 12:16:21 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[工作]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2010/11/23/statistics-phd-sas/</guid>
		<description><![CDATA[SAS中国研发中心（北京）需要招几个统计学博士（modeling+SAS）。感兴趣的朋友可以跟我联系：
jiangtanghu&#60;at&#62;gmail&#60;dot&#62;com

这里只负责牵线搭桥，具体的会安排您跟SAS R&#38;D的负责人谈。
]]></description>
			<content:encoded><![CDATA[<p>SAS中国研发中心（北京）需要招几个统计学博士（modeling+SAS）。感兴趣的朋友可以跟我联系：</p>
<blockquote><p>jiangtanghu&lt;at&gt;gmail&lt;dot&gt;com</p>
</blockquote>
<p>这里只负责牵线搭桥，具体的会安排您跟SAS R&amp;D的负责人谈。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2010/11/23/statistics-phd-sas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAS博客大观</title>
		<link>http://www.jiangtanghu.com/cn/2010/11/02/sas-blog/</link>
		<comments>http://www.jiangtanghu.com/cn/2010/11/02/sas-blog/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 13:46:14 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[人物]]></category>
		<category><![CDATA[博客]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2010/11/02/sas-blog/</guid>
		<description><![CDATA[全民皆博（非“微博”）的黄金时期已经过去，各种技术博客倒是风起云涌（再拽一个词，方兴未艾）。说说SAS博客的事。
英文世界里，SAS程序员第一个应该去的地方应该是SAS Community Planet:
http://www.sascommunity.org/planet/&#160;&#160; RSS订阅：http://www.sascommunity.org/planet/rss20.xml

现在里面收录了24个相关博客（包括“技止于此”的英文博客，From a Logical Point of View），内容涵盖SAS编程、BI、行业信息等等。另外，SAS一些员工或部门也在在其主页开博（现在是15个），见
http://support.sas.com/community/rss/

这里的博客与Planet的博客会有些重合，建议是一个个点过去，总能找到值得订阅的。比如，SAS公司负责IML开发的Rick Wicklin，今年的9月初开了一个IML相关的博客，唤作The Do Loop，现在已经有33篇了，质量都很高，而且适合不同层次的读者阅读。有意思的是，他有个明文的规矩，周一些初级篇，周三是中级篇，周五则是高级篇，各位读者，皆大欢喜（这里介绍了这么多Rick，也有一些私心。他上个月也推荐了一下我的一篇博文，也是关于IML的。之前我在blogger开英文博客，到现在也没写几篇，以后再接再厉了）。
回到中文世界。mysas论坛的掌门人shiyiming前些日子新开辟了一个栏目，叫做“SAS世博汇”，号称要“网聚全球优秀SAS博客的力量”（就是定期出爬虫抓取相关博客内容，中文为主，现在看到的数量是8个，包括Liu Wensui、ooloo等知名ID）。mysas现在也支持RSS订阅，所以这个渠道看着也还不赖。
上海还有一个活跃的朋友，sxlion，新开了一个SAS博客群，在网聚SAS博客方面，用功甚勤：
http://saslist.com/

里面提供了一批SAS中英文博客（跟上面提到的也大多重合）。这个saslist还提供博客群服务，现在还是以mysas活跃的朋友为主，比如hopewell。刚刚建起，会有些粗糙的地方，有兴趣的朋友可以上午鼓捣一下。
关于群体博客，现在做得最好的是“科学松鼠会”，科普类。另外跟统计相关的，就是“统计之都”。sas群组，现在都还是刚刚起了个头。
]]></description>
			<content:encoded><![CDATA[<p>全民皆博（非“微博”）的黄金时期已经过去，各种技术博客倒是风起云涌（再拽一个词，方兴未艾）。说说SAS博客的事。</p>
<p>英文世界里，SAS程序员第一个应该去的地方应该是<strong><a href="http://www.sascommunity.org/planet/">SAS Community Planet</a>:</strong></p>
<blockquote><p><a href="http://www.sascommunity.org/planet/">http://www.sascommunity.org/planet/</a>&#160;&#160; <a href="http://www.sascommunity.org/planet/RSS">RSS</a>订阅：<a href="http://www.sascommunity.org/planet/rss20.xml">http://www.sascommunity.org/planet/rss20.xml</a></p>
</blockquote>
<p>现在里面收录了<font color="#ff0000">24</font>个相关博客（包括“<a href="http://jiangtanghu.com/cn">技止于此</a>”的英文博客，<em><a href="http://www.jiangtanghu.com/blog/">From a Logical Point of View</a></em>），内容涵盖SAS编程、BI、行业信息等等。另外，SAS一些员工或部门也在在其主页开博（现在是<font color="#ff0000">15</font>个），见</p>
<blockquote><p><a href="http://support.sas.com/community/rss/">http://support.sas.com/community/rss/</a></p>
</blockquote>
<p>这里的博客与Planet的博客会有些重合，建议是一个个点过去，总能找到值得订阅的。比如，SAS公司负责IML开发的<a href="http://blogs.sas.com/iml/">Rick Wicklin</a>，今年的9月初开了一个IML相关的博客，唤作<a href="http://blogs.sas.com/iml/"><em>The Do Loop</em></a>，现在已经有33篇了，质量都很高，而且适合不同层次的读者阅读。有意思的是，他有个明文的规矩，周一些初级篇，周三是中级篇，周五则是高级篇，各位读者，皆大欢喜（这里介绍了这么多Rick，也有一些私心。他上个月也推荐了一下我的<a href="http://blogs.sas.com/iml/index.php?/archives/41-Learning-PROC-IML-A-SAS-Programmers-Perspective.html">一篇博文</a>，也是关于IML的。之前我在blogger开英文博客，到现在也没写几篇，以后再接再厉了）。</p>
<p>回到中文世界。<a href="http://mysas.net/forum">mysas论坛</a>的掌门人shiyiming前些日子新开辟了一个栏目，叫做“SAS世博汇”，号称要“网聚全球优秀SAS博客的力量”（就是定期出爬虫抓取相关博客内容，中文为主，现在看到的数量是<a href="http://mysas.net/forum/viewtopic.php?f=3&amp;t=6878"><font color="#ff0000">8</font>个</a>，包括Liu Wensui、ooloo等知名ID）。mysas现在也支持RSS订阅，所以这个渠道看着也还不赖。</p>
<p>上海还有一个活跃的朋友，<a href="http://saslist.com/sxlion/">sxlion</a>，新开了一个SAS博客群，在网聚SAS博客方面，用功甚勤：</p>
<blockquote><p><a href="http://saslist.com/">http://saslist.com/</a></p>
</blockquote>
<p>里面提供了一批SAS中英文博客（跟上面提到的也大多重合）。这个saslist还提供<a href="http://saslist.com/blogs/">博客群</a>服务，现在还是以mysas活跃的朋友为主，比如hopewell。刚刚建起，会有些粗糙的地方，有兴趣的朋友可以上午鼓捣一下。</p>
<p>关于群体博客，现在做得最好的是“<a href="http://songshuhui.net/">科学松鼠会</a>”，科普类。另外跟统计相关的，就是“<a href="http://cos.name/">统计之都</a>”。sas群组，现在都还是刚刚起了个头。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2010/11/02/sas-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>九月技术/行业聚会：SAS、CDISC</title>
		<link>http://www.jiangtanghu.com/cn/2010/09/18/sas-cdisc-gathering/</link>
		<comments>http://www.jiangtanghu.com/cn/2010/09/18/sas-cdisc-gathering/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 15:31:47 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[CDISC]]></category>
		<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2010/09/18/sas-cdisc-gathering/</guid>
		<description><![CDATA[九月在北京和上海分别参加了三个SAS、CDISC相关的聚会。见牛人云集，跟着乐呵了。
1.北京数据管理与生物统计论坛（BBF）第三次聚会
9月4号下午，周六，北大医学部。详见：
http://cos.name/2010/09/3rd-bbf/

2. mysas.net 线下交流
上海，谷麦咖啡店，9月11号，下午，参与者sxlion、jthu、tianwild、ahuige、shiyiming，话题：SAS非SAS，技术非技术，兴之所至，无所不聊。照片见：
http://mysas.net/sns/space.php?uid=1&#38;do=album&#38;picid=372
上海是SAS程序员的大本营。我第一次来上海，当然要去拜拜码头了。九月10号晚上我在北京发贴召集，还好有这么些活跃成员捧场。据说在上海，像这样临时凑一个局可不容易。
3. CDISC Interchange China 2010
这次CDISC交流大会中国站在上海举行，复旦大学医学院，9月15号。去年在北京办，跟同事也都参加了。一些话题：
3.1&#160; CDISC Worldwide – Highlights 2010 (including Healthcare link, JIC, BRIDG)&#160; by Frank Newby and Rebecca Kush (CDISC)
演讲者是CDISC组织的二号人物，Frank Newby（简称“牛掰”。Rebecca Kush 是CDISC组织的CEO）。由于FDA的推动，CDISC现在一个很明显的动向就是与HL7的融合。这次大会本来还安排有HL7的CEO Charles Jaffe的演讲，Hl7-CDISC Relationship，应该也会很精彩，可惜Charles 没能过来。
3.2 x3C&#160; Updates
x3C包括J3C、K3C和C3C，分别代表日本、韩国和中国的CDISC协调委员会(CDISC Coordinating Committee)，演讲者是相应组织的负责人：
J3C: Yoshio Tsukada (GSK Japan)
K3C: Sukil Kim (Catholic University of Korea)
C3C: Simon Wang (Parexel China)

今年CDISC组织在亚洲的动作很大，你可以在CDISC的博客看些更新。
3.3 CDISC Standards for Study Start-up (Business [...]]]></description>
			<content:encoded><![CDATA[<p>九月在北京和上海分别参加了三个SAS、CDISC相关的聚会。见牛人云集，跟着乐呵了。</p>
<p><strong><u>1.北京数据管理与生物统计论坛（BBF）第三次聚会</u></strong></p>
<p>9月4号下午，周六，北大医学部。详见：</p>
<blockquote><p><a href="http://cos.name/2010/09/3rd-bbf/">http://cos.name/2010/09/3rd-bbf/</a></p>
</blockquote>
<p><strong><u>2. </u></strong><a href="mysas.net "><strong><u>mysas.net</u></strong></a><strong><u> 线下交流</u></strong></p>
<p>上海，谷麦咖啡店，9月11号，下午，参与者sxlion、jthu、tianwild、ahuige、shiyiming，话题：SAS非SAS，技术非技术，兴之所至，无所不聊。照片见：</p>
<p><a href="http://mysas.net/sns/space.php?uid=1&amp;do=album&amp;picid=372">http://mysas.net/sns/space.php?uid=1&amp;do=album&amp;picid=372</a></p>
<p>上海是SAS程序员的大本营。我第一次来上海，当然要去拜拜码头了。九月10号晚上我在北京发贴召集，还好有这么些活跃成员捧场。据说在上海，像这样临时凑一个局可不容易。</p>
<p><strong><u>3. </u></strong><a href="http://www.cdisc.org/interchange-china#2329"><strong><u>CDISC Interchange China 2010</u></strong></a></p>
<p>这次CDISC交流大会中国站在上海举行，复旦大学医学院，9月15号。去年在北京办，跟同事也都参加了。一些<a href="http://www.cdisc.org/stuff/contentmgr/files/0/9fd75c86f20fcbc9a262fa8914aa205a/misc/chinainterchangeprogram_2010_08_29.pdf">话题</a>：</p>
<p><strong>3.1&#160; <em>CDISC Worldwide – Highlights 2010 (including Healthcare link, JIC, BRIDG)</em>&#160; by <font color="#ff0000">Frank Newby</font> and <font color="#ff0000">Rebecca Kush</font> (CDISC)</strong></p>
<p>演讲者是CDISC组织的二号人物，Frank Newby（简称“牛掰”。Rebecca Kush 是CDISC组织的CEO）。由于FDA的推动，CDISC现在一个很明显的动向就是与HL7的融合。这次大会本来还安排有HL7的CEO Charles Jaffe的演讲，Hl7-CDISC Relationship，应该也会很精彩，可惜Charles 没能过来。</p>
<p><strong>3.2 <em>x3C&#160; Updates</em></strong></p>
<p>x3C包括J3C、K3C和C3C，分别代表日本、韩国和中国的CDISC协调委员会(CDISC Coordinating Committee)，演讲者是相应组织的负责人：</p>
<blockquote><p>J3C: <font color="#ff0000">Yoshio Tsukada</font> (GSK Japan)</p>
<p>K3C: <font color="#ff0000">Sukil Kim</font> (Catholic University of Korea)</p>
<p>C3C: <font color="#ff0000">Simon Wang</font> (Parexel China)</p>
</blockquote>
<p>今年CDISC组织在亚洲的动作很大，你可以在<a href="http://www.cdisc.org/cdisc-blog">CDISC的博客</a>看些更新。</p>
<p><strong>3.3 <em>CDISC Standards for Study Start-up (Business Case, Protocol and Trial Registration, CDASH Standards for CRfs, eSource Data Interchange)</em> by <font color="#ff0000">Frank Newby</font> and Rebecca Kush (CDISC)</strong> </p>
<p>演讲者仍然是“牛掰”先生，强调把CDISC标准运用到临床研究的整个生命周期，从方案设计、数据收集到分析以及提交监管当局。</p>
<p>现在在概念上火的是CDASH，数据收集这块。我说是“概念”，是因为临床数据管理本身有很复杂和成熟的系统，要采用新的标准，还有很长一段路要走。</p>
<p><strong>3.4 <em>The future of Clinical Data: The Evolving Impact of CDISC and Hl7 Standards on Data Management, Submission, and Pharmacovigilance</em>&#160; by <font color="#ff0000">Wayne R. Kubick</font>&#160; (Phase Forward lincoln Safety Group)</strong></p>
<p>Wayne R. Kubick 被认为是“CDISC之父”，在CDISC组织还没有形成时就是其领军人物。这次他讲临床数据的远景，其中一条也是与HL7的融合，以后大伙应该会经常CDISC/HL7的字眼。</p>
<p>Wayne 的口音跟相貌，都跟克林顿有类似，在Lincoln Technology工作（Lincoln Technology后来被Phase Forward 收购，而Phase Forward 最近又被Oracle收购）。</p>
<p>Lincoln Technology在临床研究领域是一个非常厉害的科技公司。会后我跟Wayne 聊到他部门另外一位伟大的科学家，William DuMouchel。William 在AT&amp;T工作时发明了药物安全监测的Gamma Poisson Shrinker（伽玛泊松缩减）法，它是一种贝叶斯方法，为FDA推荐使用。</p>
<p><strong>3.5 <em>CDISC/FDA Pilot for Integrated Safety Data (Pediatrics Studies)</em> by <font color="#ff0000">Yuguang Zhao</font> (Eisai Global Clinical Development)</strong><a name="dumouchel"></a><a name="dumouchel"></a> </p>
</p>
<p> </a>
</p>
<p> CDISC的SDTM标准已经被FDA接受。这次CDISC/FDA的联合活动，类似于完全运用CDISC标准向FDA提交临床研究报告的一次预演，包括SDTM、ADaM和define.xml。
</p>
<p>这个演习活动，召集了业界二十来位好手，牵头人物是：</p>
<blockquote><p>Chris Decker, d-Wise Technologies </p>
<p>Yuguang Zhao, Eisai Pharmaceuticals </p>
<p>Steve Hirschfeld, National Institute of Health </p>
</blockquote>
<p>Yuguang之前在sanofi-aventis工作，是CDISC SDS TEAM的核心成员之一，今年上半年来我们办公室参观过。关于这次活动，你可以参考：</p>
<p><a href="http://www.d-wise.com/papers/rs02.pdf">http://www.d-wise.com/papers/rs02.pdf</a></p>
<p><strong>3.6 <em>Building an eCRf CDASH library – A</em> Case Study by <font color="#ff0000">Paula Silva</font> (Phase Forward Services)</strong></p>
<p>Paula讲的是CDISC的新宠，CDASH，以及Phase Forward公司的产品PhaseOne.</p>
<p><strong>3.7 <em>CAMD ADAS-cog Questionnaire SDTM and ADaM Implementation</em> by <font color="#ff0000">Sandy Lei</font> (J&amp;J)</strong></p>
<p>Sandy去年的CDISC活动中见过。她是中国CDISC的教母级人物，CDISC SDS TEAM的核心成员之一，前些年CDISC就是她给引进中国的。会后Sandy问我听得怎么样。我老实回答，其中只有SDTM/ADaM的部分能听懂，关于<em>CAMD ADAS-cog </em>听得是一愣一愣的。回北京我是恶补了一下，你也可以参考下：</p>
<p><a href="http://www.c-path.org/pdf/CAMDWorkScope.pdf">http://www.c-path.org/pdf/CAMDWorkScope.pdf</a></p>
<p><strong>3.8 <em>Update on Terminology and SHARE Project</em> by <font color="#ff0000">Chris Tolk</font> (CDISC)</strong></p>
<p>Chris在CDISC组织里负责Terminology，她也是CDISC其他标准的活跃参与者。CDISC组织维护的Terminology，也被NCI的EVS系统收录，算是一个很大的成就了。</p>
<p><strong>3.9 <em>Integration of Electronic Data Capture (EDC) and Interactive Voice Response (IVR) randomization systems using ODM, vendor extensions and web services </em>by <font color="#ff0000">Andrew Newbigging </font>(Medidata Solutions Worldwide)</strong></p>
<p>又是一位牛人(New&#8211;)，Andrew Newbigging讲的是在EDC以及IVR系统运用CDISC的ODM模型，又是临床数据管理方面的内容。</p>
<p><strong>3.10 <em>XML: The SAS Approach</em> by <font color="#ff0000">John (Jiangtang) Hu</font> and <font color="#ff0000">Na Ye</font> (Sanof Pasteur Biostatistics China)</strong></p>
<p>我跟同事Na带来的话题安排在下午，最后一场，以契合我们业界小兵的形象。来上海之前我在公司排练过一次，这次讲完后，有朋友提醒，我演讲时手一有机会就插兜里，噫。不是为了摆酷，手本来就跟香蕉一样，上台时就不知道该放哪。</p>
<p>CDISC各个标准，其数据都是通过XML来储存和传输，我们这个话题就是来讨论如何用SAS来处理XML数据——SAS程序员嘛。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2010/09/18/sas-cdisc-gathering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAS书杂谈（1）：两本统计书</title>
		<link>http://www.jiangtanghu.com/cn/2010/08/08/sas-stat/</link>
		<comments>http://www.jiangtanghu.com/cn/2010/08/08/sas-stat/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 10:35:03 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[生物统计]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2010/08/08/sas-stat/</guid>
		<description><![CDATA[1. Categorical Data Analysis Using the SAS System (2nd edition, SAS Inc., 2000) 
作者三位（SDK），在这个领域都是行家，SAS公司的一位负责统计工具研发的总监Maura E. Stokes , 爱荷华大学生物统计系的教授Charles S. Davis（后来他投身工业界）以及北卡大学教堂山分校生物统计系的教授 Gary G. Koch 。用SAS做Categorical Data Analysis，这书是引用最多的一本。国内一本书，刘勤和金丕焕编的《分类数据的统计分析及SAS编程》（复旦大学出版社，2002），能看到本书的影子（美中不足的是，这本书丝毫没有提到SDK）。
我喜欢这本书，还因为它是我读过的SAS BBU（books by users）系列中排版较好的一本。BBU一般由SAS Press或Wiley两家出版社出版，一个印象是，Wiley出的SAS书排版会比SAS Press的质量高。这本书由这两家联合出版。
以前学Categorical Data Analysis，上手就是Logistic回归，做信用评分/数据挖掘需要这个（这本书的后半部分讲这些模型）。现在的工作，需要多的是本书的前半部分，对列联表做的各种检验，这是统计学里相对传统的部分，也是我这样非统计科班出身学统计学时忽略最多的部分。
还有，这本书的数序公式用得恰到好处，简洁又富有启发性，能让一个（只）有基本数学素养的SAS 程序员体会到模型的含义，又不至于淹没在数学符号的汪洋大海之中。
2.Common Statistical Methods for Clinical Research with SAS Examples(2nd edition, SAS Inc., 2002)
作者是SAS最老的一批咨询顾问Glenn A. Walker。现在这书出了第三版，加上了一位合作者，Duke Clinical Research Institute（世界上最大的学院CRO）的一位SAS程序员，Jack Shostak，他也是SAS Programming in the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1. <em><a href="http://www.amazon.com/Categorical-Data-Analysis-Using-System/dp/1580257100/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1281236405&amp;sr=1-1-spell">Categorical Data Analysis Using the SAS System</a></em> (2nd edition, SAS Inc., 2000)</strong> </p>
<p>作者三位（SDK），在这个领域都是行家，SAS公司的一位负责统计工具研发的总监<a href="http://support.sas.com/publishing/authors/stokes.html">Maura E. Stokes</a> , 爱荷华大学生物统计系的教授<a href="http://www.csdbiostat.com/">Charles S. Davis</a>（后来他投身工业界）以及北卡大学教堂山分校生物统计系的教授 <a href="http://www.sph.unc.edu/?option=com_profiles&amp;Itemid=1867&amp;profileAction=ProfDetail&amp;pid=703747022">Gary G. Koch</a> 。用SAS做Categorical Data Analysis，这书是引用最多的一本。国内一本书，刘勤和金丕焕编的《<a href="http://www.china-pub.com/756634">分类数据的统计分析及SAS编程</a>》（复旦大学出版社，2002），能看到本书的影子（美中不足的是，这本书丝毫没有提到SDK）。</p>
<p>我喜欢这本书，还因为它是我读过的SAS BBU（books by users）系列中排版较好的一本。BBU一般由SAS Press或Wiley两家出版社出版，一个印象是，Wiley出的SAS书排版会比SAS Press的质量高。这本书由这两家联合出版。</p>
<p>以前学Categorical Data Analysis，上手就是<a href="http://cos.name/2008/12/measure-classification-model-performance-confusion-matrix/">Logistic回归</a>，做信用评分/数据挖掘需要这个（这本书的后半部分讲这些模型）。现在的工作，需要多的是本书的前半部分，对列联表做的各种检验，这是统计学里相对传统的部分，也是我这样非统计科班出身学统计学时忽略最多的部分。</p>
<p>还有，这本书的数序公式用得恰到好处，简洁又富有启发性，能让一个（只）有基本数学素养的SAS 程序员体会到模型的含义，又不至于淹没在数学符号的汪洋大海之中。</p>
<p><strong>2.<em><a href="http://www.amazon.com/Statistical-Methods-Clinical-Research-Examples/dp/1590470400/ref=sr_1_2?s=books&amp;ie=UTF8&amp;qid=1281254785&amp;sr=1-2">Common Statistical Methods for Clinical Research with SAS Examples</a></em>(2nd edition, SAS Inc., 2002)</strong></p>
<p>作者是SAS最老的一批咨询顾问<a href="http://support.sas.com/publishing/authors/walker.html">Glenn A. Walker</a>。现在这书出了第三版，加上了一位合作者，<a href="https://www.dcri.org/">Duke Clinical Research Institute</a>（世界上最大的学院CRO）的一位SAS程序员，<a href="http://support.sas.com/publishing/authors/shostak.html">Jack Shostak</a>，他也是<a href="http://www.amazon.com/Programming-Pharmaceutical-Industry-Jack-Shostak/dp/1590477936/ref=pd_sim_b_3"><em>SAS Programming in the Pharmaceutical Industry</em></a>的作者。</p>
<p>我没有比较与新版的区别，只说说手头的第二版。跟SDK一样，这本书是用来恶补现在所需要的统计学基础的，给回归只留了两个章节：</p>
<blockquote><p>Chapter 1 – Introduction &amp; Basics&#160; <br />Chapter 2 – Topics in Hypothesis Testing&#160; <br />Chapter 3 – The Data Set TRIAL&#160; <br />Chapter 4 – The One-Sample t-Test&#160; <br />Chapter 5 – The Two-Sample t-Test&#160; <br />Chapter 6 – One-Way ANOVA&#160; <br />Chapter 7 – Two-Way ANOVA&#160; <br />Chapter 8 – Repeated Measures Analysis       <br />Chapter 9 – The Crossover Design       <br />Chapter 10 – Linear Regression       <br />Chapter 11 – Analysis of Covariance       <br />Chapter 12 – The Wilcoxon Signed-Rank Test       <br />Chapter 13 – The Wilcoxon Rank-Sum Test&#160; <br />Chapter 14 – The Kruskal-Wallis Test       <br />Chapter 15 – The Binomial Test       <br />Chapter 16 – The Chi-Square Test       <br />Chapter 17 – Fisher’s Exact Test       <br />Chapter 18 – McNemar’s Test       <br />Chapter 19 – The Cochran-Mantel-Haenszel Test       <br />Chapter 20 – Logistic Regression       <br />Chapter 21 – The Log-Rank Test       <br />Chapter 22 – The Cox Proportional Hazards Model </p>
</blockquote>
<p>章节设置，跟Jerrold Zar那册有名的<em><a href="http://www.amazon.com/Biostatistical-Analysis-5th-Jerrold-Zar/dp/0131008463/ref=sr_1_1?s=books&amp;ie=UTF8&amp;qid=1281258373&amp;sr=1-1">Biostatistical Analysis</a></em>类似，正好方便SAS程序员备查。这些统计学，在药厂的clinical部门常用。至于模型味更浓的data mining系列，discovery和pharmacovigilance（PV，药物警戒）部门用得多些。</p>
<p>这本书在写作方面没什么特色，好处在于实用、全面，做工具书再好不过。</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>作为非统计出身的SAS程序员，经常徜徉于data steps，现在翻翻它的统计部分，又能感受到它背后的另一片广阔天地。浏览一下SAS/STAT 9.2的<a href="http://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#/documentation/cdl/en/statug/63347/HTML/default/statug_chap0_sect003.htm">研发团队</a>，——罗列书名、人名总能激起我的斗志，噫。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2010/08/08/sas-stat/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Excel杂谈</title>
		<link>http://www.jiangtanghu.com/cn/2010/05/22/excel-sas/</link>
		<comments>http://www.jiangtanghu.com/cn/2010/05/22/excel-sas/#comments</comments>
		<pubDate>Sat, 22 May 2010 13:50:03 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[Computers and Internet]]></category>
		<category><![CDATA[SAS]]></category>
		<category><![CDATA[BI]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Excelpro]]></category>
		<category><![CDATA[Excel图表之道——如何制作专业有效的商务图表]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[商务智能]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2010/05/22/excel-sas/</guid>
		<description><![CDATA[ 
昨晚提到Excelpro的新书，《Excel图表之道——如何制作专业有效的商务图表》（刘万祥，北京：电子工业出版社，2010）。说些Excel，从一个SAS程序员的角度。
相对SAS，或其他的软件包（SPSS、R/S-Plus、Matlab等），Excel都是一个轻量级的分析工具。本来，Excel无意在统计分析方面跟那些统计工具包一较长短，各有适用的地方而已。但在商业世界，用Excel做分析的用户太多了，说最流行也不为过，一些统计学者，就提醒广大用户，用Excel做统计分析时一定要谨慎些，它有时候不够严谨有时候不够靠谱。详细的，可以参考谢益辉的三篇博文（以及他文中所附的参考材料）：
1.Excel中的缺失值和0
2.为什么避免用Excel作统计计算
3.再谈为什么不用Excel做统计分析

用Excel本身的计算引擎有时是不够严谨，这是故事的一个方面（当然，它应付日常工作还是可以胜任的，对Excel，我们这点信心还是有）。故事的另一个方面，是鉴于Excel的广泛流行，各大BI（商务智能）套件，包括SAS系统，都要提供与Office/Excel整合的功能。上面就是 SAS Add-In for Microsoft Office在Excel里面的一个截图。利用这个Excel插件，商业用户可以继续使用他/她熟悉的Excel，访问SAS数据，并利用SAS的计算引擎来分析和作图，最后结果返回到Excel（或者Word、PPT）。一家公司不提供这玩意，它的BI技术就要受到质疑，至少也是没有做到user-friendly。夸张点说，小小的Excel就这样爬上了BI平台的最顶端。
我们注意到，与Excel的整合，重点是把它作为用户接口和展示平台。对一个传统的SAS程序员，与Excel打交道也是他职业生涯的一部分：
1. 有时候，数据会存储在Excel里面。你可能没法理解，为什么要把数据存在Excel里面，这样轻量级的数据，存在文本里面不是更好吗？在真实世界里，大部分人的行为模式一般是这样，他们打开Word来记事，打开Excel来记录数据。数据存在Excel或许也能接受，如果它们规规矩矩，行列有序。有一种情形就是，在一个Excel Book里，数据散布于各个Sheets，在同一个Sheet，数据可能不是按行列来排，而是长得就像一个report。平心而论，这样的数据真的是user-friendly，只是不够machine-friendly。在Windows平台下，SAS Base有三种最常用的方式读取Excel数据：
1-1 proc import or Import Wizard
1-2 SAS Excel Libname Engine
1-3 SAS DDE (Dynamic Data Exchange，这属于Windows的技术)

Excel不是一个跨平台的数据格式。在Unix平台下，如何读取Excel数据呢？SAS也有解决方案，那需要用到一个SAS/ACCESS Interface to PC Files for UNIX和SAS PC File Server for Windows，这也是一个Libname Engine的方式。
2. 读入Excel数据，一个相反的操作就是把SAS数据（或output）转化成Excel。程序员或许不太愿意，但这在商业世界有需求。这里SAS更是提供了五花八门的解决方案：
2-1 proc Export or Export Wizard
2-2 SAS Excel Libname Engine
2-3 SAS DDE (Dynamic Data Exchange)
2-4 proc printto
2-5 SAS ODS
2-6 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jiangtanghu.com/cn/wp-content/uploads/2010/05/SASExcel.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="SAS-Excel" border="0" alt="SAS-Excel" src="http://www.jiangtanghu.com/cn/wp-content/uploads/2010/05/SASExcel_thumb.jpg" width="369" height="269" /></a> </p>
<p><a href="http://www.jiangtanghu.com/cn/2010/05/21/%E3%80%8Aexcel%E5%9B%BE%E8%A1%A8%E4%B9%8B%E9%81%93%E3%80%8B%E4%B9%A6%E5%92%8C%E4%BA%BA/">昨</a>晚提到<a href="http://excelpro.blog.sohu.com/">Excelpro</a>的新书，《<a href="http://book.douban.com/subject/4326057/">Excel图表之道——如何制作专业有效的商务图表</a>》（刘万祥，北京：电子工业出版社，2010）。说些Excel，从一个SAS程序员的角度。</p>
<p>相对SAS，或其他的软件包（SPSS、R/S-Plus、Matlab等），Excel都是一个轻量级的分析工具。本来，Excel无意在统计分析方面跟那些统计工具包一较长短，各有适用的地方而已。但在商业世界，用Excel做分析的用户太多了，说最流行也不为过，一些统计学者，就提醒广大用户，用Excel做统计分析时一定要谨慎些，它有时候不够严谨有时候不够靠谱。详细的，可以参考<a href="http://yihui.name">谢益辉</a>的三篇博文（以及他文中所附的参考材料）：</p>
<blockquote><p>1.<a href="http://yihui.name/cn/2008/08/missing-value-and-zero-in-excel/">Excel中的缺失值和0</a></p>
<p>2.<a href="http://yihui.name/cn/2008/09/why-avoid-excel-to-do-calculation/">为什么避免用Excel作统计计算</a></p>
<p>3.<a href="http://yihui.name/cn/2008/10/why-avoid-excel-in-statistics/">再谈为什么不用Excel做统计分析</a></p>
</blockquote>
<p>用Excel本身的计算引擎有时是不够严谨，这是故事的一个方面（当然，它应付日常工作还是可以胜任的，对Excel，我们这点信心还是有）。故事的另一个方面，是鉴于Excel的广泛流行，各大BI（商务智能）套件，包括SAS系统，都要提供与Office/Excel整合的功能。上面就是 <a href="http://www.sas.com/resources/factsheet/sas-ms-office-addin-factsheet.pdf">SAS Add-In for Microsoft Office</a>在Excel里面的一个截图。利用这个Excel插件，商业用户可以继续使用他/她熟悉的Excel，访问SAS数据，并利用SAS的计算引擎来分析和作图，最后结果返回到Excel（或者Word、PPT）。一家公司不提供这玩意，它的BI技术就要受到质疑，至少也是没有做到user-friendly。夸张点说，小小的Excel就这样爬上了BI平台的最顶端。</p>
<p>我们注意到，与Excel的整合，重点是把它作为用户接口和展示平台。对一个传统的SAS程序员，与Excel打交道也是他职业生涯的一部分：</p>
<p>1. 有时候，数据会存储在Excel里面。你可能没法理解，为什么要把数据存在Excel里面，这样轻量级的数据，存在文本里面不是更好吗？在真实世界里，大部分人的行为模式一般是这样，他们打开Word来记事，打开Excel来记录数据。数据存在Excel或许也能接受，如果它们规规矩矩，行列有序。有一种情形就是，在一个Excel Book里，数据散布于各个Sheets，在同一个Sheet，数据可能不是按行列来排，而是长得就像一个report。平心而论，这样的数据真的是user-friendly，只是不够machine-friendly。在Windows平台下，SAS Base有三种最常用的方式读取Excel数据：</p>
<blockquote><p>1-1 proc import or Import Wizard</p>
<p>1-2 SAS Excel Libname Engine</p>
<p>1-3 SAS DDE (Dynamic Data Exchange，这属于Windows的技术)</p>
</blockquote>
<p>Excel不是一个跨平台的数据格式。在Unix平台下，如何读取Excel数据呢？SAS也有解决方案，那需要用到一个SAS/ACCESS Interface to PC Files for UNIX和SAS PC File Server for Windows，这也是一个Libname Engine的方式。</p>
<p>2. 读入Excel数据，一个相反的操作就是把SAS数据（或output）转化成Excel。程序员或许不太愿意，但这在商业世界有需求。这里SAS更是提供了五花八门的解决方案：</p>
<blockquote><p>2-1 proc Export or Export Wizard</p>
<p>2-2 SAS Excel Libname Engine</p>
<p>2-3 SAS DDE (Dynamic Data Exchange)</p>
<p>2-4 proc printto</p>
<p>2-5 SAS ODS</p>
<p>2-6 data steps </p>
<p>2-7&#160; SAS Add-In for Excel</p>
<p>……</p>
</blockquote>
<p>除了DDE，你还可以利用其他非SAS技术，比如ODBC、OLE DB等。有一个小花招。利用ODS，可以把数据转化成用户可以用Excel打开的CSV、XML或者HTML格式，而它们本身是比.xls更优越的存储格式。特别是CSV(comma-separated values file)，本身是文本文件，在Windows世界里，很多用户都把它当成Excel的一种格式，默认的打开方式也是Excel（而不是文本编辑器）。</p>
<p>罗列了这么多SAS与Excel的交互，回到Excel本身。它是一个功能强大的电子表格，在数据分析与展示方面也有不俗的表现（Excel作图，可以参考上面提到的<a href="http://excelpro.blog.sohu.com/">Excelpro</a>所达到的境界）。它赢得如此多的用户，说明它能满足大部分人大部分的需求。一个SAS用户，或者SPSS、R/S-Plus、Matlab等用户不必在统计分析方面展示对Excel的优越，这样显得就不够大气了——本来Excel就无意在这方面跟它们竞争。况且，即使工具之间有优劣，工具的本身的先后也不代表他们用户的先后，急于争辩工具厉害的人，往往忽略了人本身，自以为手持屠龙刀，就无敌于天下。笑话。</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>再讲个笑话，跟<a href="http://yihui.name">谢益辉</a>有关（最近举例似乎老拿谢同学说事）。谢于数据可视化颇有研究，最近秀出了不少的工作，当然都是用R来展示。楼下便有人惊呼：R好强大啊。不知道谢听了做如何想。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2010/05/22/excel-sas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SAS vs. R</title>
		<link>http://www.jiangtanghu.com/cn/2010/04/22/r-sas/</link>
		<comments>http://www.jiangtanghu.com/cn/2010/04/22/r-sas/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 14:32:19 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[Computers and Internet]]></category>
		<category><![CDATA[SAS]]></category>
		<category><![CDATA[COS]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[统计之都]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2010/04/22/r-sas/</guid>
		<description><![CDATA[在“统计之都”(COS)发布了一篇《Think&#160; SAS》，是有感于R在学院（尤其是统计系）的流行，主要是写给对工业界感兴趣的在校生看，动员他们在学R之余，不妨考虑一下SAS。不想却引来长篇的R与SAS之争。关于软件的功能，比如R或SAS，本身没有任何问题：一个语言，只要能使分支语句和循环，再加上极少的要求，就可以完成几乎所有的任务了（语言的完备性，要求其实很简单）。所以讨论R与SAS谁更强大，意义不大，这更多是个人使用偏好的问题。在“统计之都”的博客文章，评论大多很精彩，有的甚至要超过正文，读者朋友不妨移步观望下。这将会是一个系列文章，陆续在COS发布，慢慢写了。
又，关于R与SAS，Peter Flom也在写系列比较文章，见
1. SAS v. R: Ease of learning
0. SAS vs. R: Introduction and request
]]></description>
			<content:encoded><![CDATA[<p>在“<a href="http://cos.name">统计之都</a>”(COS)发布了一篇《<a href="http://cos.name/2010/04/think-sas-1/">Think&#160; SAS</a>》，是有感于R在学院（尤其是统计系）的流行，主要是写给对工业界感兴趣的在校生看，动员他们在学R之余，不妨考虑一下SAS。不想却引来长篇的R与SAS之争。关于软件的功能，比如R或SAS，本身没有任何问题：一个语言，只要能使分支语句和循环，再加上极少的要求，就可以完成几乎所有的任务了（语言的完备性，要求其实很简单）。所以讨论R与SAS谁更强大，意义不大，这更多是个人使用偏好的问题。在“<a href="http://cos.name">统计之都</a>”的博客文章，评论大多很精彩，有的甚至要超过正文，读者朋友不妨移步观望下。这将会是一个系列文章，陆续在COS发布，慢慢写了。</p>
<p>又，关于R与SAS，<a href="http://www.statisticalanalysisconsulting.com/blog/">Peter Flom</a>也在写系列比较文章，见</p>
<p>1. <em><a href="http://www.statisticalanalysisconsulting.com/sas-v-r-ease-of-learning/">SAS v. R: Ease of learning</a></em></p>
<p>0<em>. <a href="http://www.statisticalanalysisconsulting.com/sas-vs-r-introduction-and-request/">SAS vs. R: Introduction and request</a></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2010/04/22/r-sas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SAS 认证</title>
		<link>http://www.jiangtanghu.com/cn/2010/04/08/sas-certification/</link>
		<comments>http://www.jiangtanghu.com/cn/2010/04/08/sas-certification/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 14:53:14 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[SAS Certification]]></category>
		<category><![CDATA[SAS Certified Advanced Programmer for SAS 9 Credential]]></category>
		<category><![CDATA[SAS Certified Base Programmer for SAS 9 Credential]]></category>
		<category><![CDATA[SAS Certified Predictive Modeler using SAS Enterprise Miner 5 Credential]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2010/04/08/sas-certification/</guid>
		<description><![CDATA[上午八点半到的知春里的中科软，九点开考，九点半出来，接着赶回公司。上午就这么考了人生第一个除英语六级外的认证，SAS Certified Base Programmer for SAS 9 Credential，一共是70道题（要求时间是两个小时），错了一道，拿了99/100分回家。还好，我06年开始接触SAS，并以此为生，这个成绩不算丢脸。
为什么想到考这个证？美国那里有句话说，“如果你有个SAS认证，你将不愁找不到工作”云云。对有经验的SAS程序员，雇主一般不在乎你是否考过SAS认证，我推荐在校生没事可以整这么一个，可以增加些筹码，以示自己也算是有些投资，花过功夫。我现在不需要这个认证找工作，倒是想借这个机会，重温一些基本概念。SAS公司有一份Base的认证文档说这可以refresh your mind on some details you might have forgotter,就是这个。当然，还有一个很重要的原因，现在考证，可以找东家报销（150美元，很大的一块蚊子肉啊），——做学生时穷，虽然只要半价，还是舍不得考。
计划下半年再考一次SAS Certified Advanced Programmer for SAS 9 Credential，这个拿高分还算是有些挑战性。为考试而考试是个很无聊的事，那就借着这个机会，温习下SAS Advance的东西，这些在日常工作中都要用到，相互促进了。
其实我最想考的是SAS Certified Predictive Modeler using SAS Enterprise Miner 5 Credential，数据挖掘相关的。读书时鼓捣得比较多，现在工作几乎都要忘掉这些了，考个证可以刺激下自个。啥时有机会去美国遛达，就乘机考了这厮。SAS Base和Advance都可以在国内考，唯有这DM需要在美国的SAS公司考。
附些材料，感兴趣的朋友可以参考。
1. 报名，SAS Base和Advance都可以网上预约，或者直接到考场报名，费用是150美元（或相应的人民币）。
预约或查询考点，上www.prometric.com/sas，有国际信用卡就可以支付。
又，考试时间也是可以预定的，从早上八点开始。我订的是早九点，早八点考场工作人员可能都在调试机器，拖后些比较好。
2.参考资料。对考Base来说，SAS公司的SAS OnlineTutor®: Basic and Intermediate SAS，止矣尽矣。这是我见到过的最好的入门材料。或者，同等有分量的入门材料，SAS Programming I: Essential和SAS Programming II: Data Manipulation Techniques。这些材料，既可以为准备考试用，更可以作为入门温习提高用。从准备考试来讲，它们比SAS Little Book实用。
]]></description>
			<content:encoded><![CDATA[<p>上午八点半到的知春里的中科软，九点开考，九点半出来，接着赶回公司。上午就这么考了人生第一个除英语六级外的认证，<a href="http://support.sas.com/certify/creds/bp.html">SAS Certified Base Programmer for SAS 9 Credential</a>，一共是70道题（要求时间是两个小时），错了一道，拿了99/100分回家。还好，我06年开始接触SAS，并以此为生，这个成绩不算丢脸。</p>
<p>为什么想到考这个证？美国那里有句话说，“如果你有个SAS认证，你将不愁找不到工作”云云。对有经验的SAS程序员，雇主一般不在乎你是否考过SAS认证，我推荐在校生没事可以整这么一个，可以增加些筹码，以示自己也算是有些投资，花过功夫。我现在不需要这个认证找工作，倒是想借这个机会，重温一些基本概念。SAS公司有一份Base的认证文档说这可以refresh your mind on some details you might have forgotter,就是这个。当然，还有一个很重要的原因，现在考证，可以找东家报销（150美元，很大的一块蚊子肉啊），——做学生时穷，虽然只要半价，还是舍不得考。</p>
<p>计划下半年再考一次<a href="http://support.sas.com/certify/creds/ap.html">SAS Certified Advanced Programmer for SAS 9 Credential</a>，这个拿高分还算是有些挑战性。为考试而考试是个很无聊的事，那就借着这个机会，温习下SAS Advance的东西，这些在日常工作中都要用到，相互促进了。</p>
<p>其实我最想考的是<a href="http://support.sas.com/certify/creds/dm.html">SAS Certified Predictive Modeler using SAS Enterprise Miner 5 Credential</a>，数据挖掘相关的。读书时鼓捣得比较多，现在工作几乎都要忘掉这些了，考个证可以刺激下自个。啥时有机会去美国遛达，就乘机考了这厮。SAS Base和Advance都可以在国内考，唯有这DM需要在美国的SAS公司考。</p>
<p>附些材料，感兴趣的朋友可以参考。</p>
<p>1. 报名，SAS Base和Advance都可以网上预约，或者直接到考场报名，费用是150美元（或相应的人民币）。</p>
<p>预约或查询考点，上<a href="http://www.prometric.com/sas">www.prometric.com/sas</a>，有国际信用卡就可以支付。</p>
<p>又，考试时间也是可以预定的，从早上八点开始。我订的是早九点，早八点考场工作人员可能都在调试机器，拖后些比较好。</p>
<p>2.参考资料。对考Base来说，SAS公司的<strong><em>SAS OnlineTutor<sup>®</sup>: Basic and Intermediate SAS</em></strong>，止矣尽矣。这是我见到过的最好的入门材料。或者，同等有分量的入门材料，SAS Programming I: Essential和SAS Programming II: Data Manipulation Techniques。这些材料，既可以为准备考试用，更可以作为入门温习提高用。从准备考试来讲，它们比<em>SAS Little Book</em>实用。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2010/04/08/sas-certification/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>技术博客重新开张</title>
		<link>http://www.jiangtanghu.com/cn/2010/01/04/opening/</link>
		<comments>http://www.jiangtanghu.com/cn/2010/01/04/opening/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 16:06:20 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[人物]]></category>
		<category><![CDATA[统计备忘录]]></category>
		<category><![CDATA[胡说]]></category>
		<category><![CDATA[技术博客]]></category>
		<category><![CDATA[统计之都]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/2010/01/04/opening/</guid>
		<description><![CDATA[把以前在space写的文字都导入到这个新博客里了。
这新得白花花扎眼的一年，还想多写些关于SAS程序员本身的文字，关于这个职业，它依托的行业环境等等。SAS程序员在国内还不是一个很兴盛的职业。
还会有关于SAS本身的文字，关于SAS语言，SAS公司，关于它的创始人等等。最近我对SAS的创始人Tony Barr比较感兴趣。
技术本身，这个跟饭碗相关，除了SAS技术，很多笔墨可能会停留在CDISC上面。当然还会有自个兴之所至的其他文字，才年初呢，啥都没定。作为跟“统计之都”的约定，所有跟统计相关的文字，我会首先发布到“统计之都”，然后在自个的博客做个备份：
http://cos.name/author/hujiangtang/

]]></description>
			<content:encoded><![CDATA[<p>把以前在<a href="http://johnthu.spaces.live.com/">space</a>写的文字都导入到这个新博客里了。</p>
<p>这新得白花花扎眼的一年，还想多写些关于SAS程序员本身的文字，关于这个职业，它依托的行业环境等等。SAS程序员在国内还不是一个很兴盛的职业。</p>
<p>还会有关于SAS本身的文字，关于SAS语言，SAS公司，关于它的创始人等等。最近我对SAS的创始人Tony Barr比较感兴趣。</p>
<p>技术本身，这个跟饭碗相关，除了SAS技术，很多笔墨可能会停留在CDISC上面。当然还会有自个兴之所至的其他文字，才年初呢，啥都没定。作为跟“<a href="http://cos.name/">统计之都</a>”的约定，所有跟统计相关的文字，我会首先发布到“统计之都”，然后在自个的博客做个备份：</p>
<blockquote><p><a href="http://cos.name/author/hujiangtang/">http://cos.name/author/hujiangtang/</a></p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2010/01/04/opening/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FYI: 用SAS/Graph做仪表盘(Dashboard)</title>
		<link>http://www.jiangtanghu.com/cn/2009/01/14/fyi-%e7%94%a8sasgraph%e5%81%9a%e4%bb%aa%e8%a1%a8%e7%9b%98dashboard/</link>
		<comments>http://www.jiangtanghu.com/cn/2009/01/14/fyi-%e7%94%a8sasgraph%e5%81%9a%e4%bb%aa%e8%a1%a8%e7%9b%98dashboard/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9994</guid>
		<description><![CDATA[ 
以前提到过，SAS一个员工做了一份给圣诞老人用的dashboard，在YouTube也能找到。最近Support.sas.com公布了一批Dashboard示例，比较有意思，不妨一看：
http://support.sas.com/kb/26/134.html
具体的：

Slider chart indicator:

SAS program version 
stored process version 
portlet version



Slider chart dashboard:

SAS program version 
stored process version 
portlet version


Bullet graph indicator:

SAS program version 
stored process version 
portlet version


Bullet graph dashboard:

SAS program version 
stored process version 
portlet version


Dial meter indicator:

SAS program version 
stored process version 
portlet version


Dial meter dashboard:

SAS program version 
stored process version 
portlet [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://7hcwaw.bay.livefilestore.com/y1p_uA_BREIVHgB5xmLx9iIy_EEQACmYH0hdqw2JnApHH_fS8hw4QKcYJ_g6u3oV6jg8SxhwKduMG0sbcCUZRAnkw?PARTNER=WRITER"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height="298" alt="dashboard" src="http://byfiles.storage.msn.com/y1pQSi2Ir1lBhABHdgWP3adYc5URY7K2BwvXyzTCuldRKj7yq7N4AeQwUIq4_6XAAmMFfWVxsxtxW_a-aJNx4iy3g?PARTNER=WRITER" width="396" border="0" /></a> </p>
<p>以前提到过，SAS一个员工做了一份给圣诞老人用的<a href="http://jiangtanghu.blogspot.com/2008/12/santa-and-sas-again-santa-dashboard.html" target="_blank">dashboard</a>，在<a href="http://www.youtube.com/watch?v=g2oGdKzX8pg" target="_blank">YouTube</a>也能找到。最近Support.sas.com公布了一批Dashboard示例，比较有意思，不妨一看：</p>
<p><a title="http://support.sas.com/kb/26/134.html" href="http://support.sas.com/kb/26/134.html">http://support.sas.com/kb/26/134.html</a></p>
<p>具体的：</p>
<ul>
<li>Slider chart indicator:
<ul>
<li><a href="http://support.sas.com/kb/26104.html">SAS program version</a> </li>
<li><a href="http://support.sas.com/kb/26114.html">stored process version</a> </li>
<li><a href="http://support.sas.com/kb/26124.html">portlet version</a></li>
</ul>
</li>
</ul>
<li>Slider chart dashboard:
<ul>
<li><a href="http://support.sas.com/kb/26105.html">SAS program version</a> </li>
<li><a href="http://support.sas.com/kb/26115.html">stored process version</a> </li>
<li><a href="http://support.sas.com/kb/26125.html">portlet version</a></li>
</ul>
</li>
<li>Bullet graph indicator:
<ul>
<li><a href="http://support.sas.com/kb/26106.html">SAS program version</a> </li>
<li><a href="http://support.sas.com/kb/26116.html">stored process version</a> </li>
<li><a href="http://support.sas.com/kb/26126.html">portlet version</a></li>
</ul>
</li>
<li>Bullet graph dashboard:
<ul>
<li><a href="http://support.sas.com/kb/26107.html">SAS program version</a> </li>
<li><a href="http://support.sas.com/kb/26117.html">stored process version</a> </li>
<li><a href="http://support.sas.com/kb/26127.html">portlet version</a></li>
</ul>
</li>
<li>Dial meter indicator:
<ul>
<li><a href="http://support.sas.com/kb/26108.html">SAS program version</a> </li>
<li><a href="http://support.sas.com/kb/26118.html">stored process version</a> </li>
<li><a href="http://support.sas.com/kb/26128.html">portlet version</a></li>
</ul>
</li>
<li>Dial meter dashboard:
<ul>
<li><a href="http://support.sas.com/kb/26109.html">SAS program version</a> </li>
<li><a href="http://support.sas.com/kb/26119.html">stored process version</a> </li>
<li><a href="http://support.sas.com/kb/26129.html">portlet version</a></li>
</ul>
</li>
<li>Bar chart indicator:
<ul>
<li><a href="http://support.sas.com/kb/26110.html">SAS program version</a> </li>
<li><a href="http://support.sas.com/kb/26120.html">stored process version</a> </li>
<li><a href="http://support.sas.com/kb/26130.html">portlet version</a></li>
</ul>
</li>
<li>Bar chart dashboard:
<ul>
<li><a href="http://support.sas.com/kb/26111.html">SAS program version</a> </li>
<li><a href="http://support.sas.com/kb/26121.html">stored process version</a> </li>
<li><a href="http://support.sas.com/kb/26131.html">portlet version</a></li>
</ul>
</li>
<li>Telesales dashboard:
<ul>
<li><a href="http://support.sas.com/kb/26112.html">SAS program version</a> </li>
<li><a href="http://support.sas.com/kb/26122.html">stored process version</a> </li>
<li><a href="http://support.sas.com/kb/26132.html">portlet version</a></li>
</ul>
</li>
<li>Web marketing analysis dashboard:
<ul>
<li><a href="http://support.sas.com/kb/26113.html">SAS program version</a> </li>
<li><a href="http://support.sas.com/kb/26123.html">stored process version</a> </li>
<li><a href="http://support.sas.com/kb/26133.html">portlet version</a></li>
</ul>
</li>
<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">del.icio.us Tags: <a href="http://del.icio.us/popular/SAS" rel="tag">SAS</a>,<a href="http://del.icio.us/popular/Dashboard" rel="tag">Dashboard</a>,<a href="http://del.icio.us/popular/%e4%bb%aa%e8%a1%a8%e7%9b%98" rel="tag">仪表盘</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2009/01/14/fyi-%e7%94%a8sasgraph%e5%81%9a%e4%bb%aa%e8%a1%a8%e7%9b%98dashboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAS金融函数（1）：期权定价（new in SAS9.2 Base）</title>
		<link>http://www.jiangtanghu.com/cn/2009/01/06/sas%e9%87%91%e8%9e%8d%e5%87%bd%e6%95%b0%ef%bc%881%ef%bc%89%ef%bc%9a%e6%9c%9f%e6%9d%83%e5%ae%9a%e4%bb%b7%ef%bc%88new-in-sas9-2-base%ef%bc%89/</link>
		<comments>http://www.jiangtanghu.com/cn/2009/01/06/sas%e9%87%91%e8%9e%8d%e5%87%bd%e6%95%b0%ef%bc%881%ef%bc%89%ef%bc%9a%e6%9c%9f%e6%9d%83%e5%ae%9a%e4%bb%b7%ef%bc%88new-in-sas9-2-base%ef%bc%89/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9992</guid>
		<description><![CDATA[以前贴过一份SAS9.1 Base的金融函数（23个。SAS9.1/ETS还有9个），惜乎没有展开来讲。现在SAS9.2 Base新增了一些有意思的金融函数（还有一些调整，比如，SAS9.1/ETS那9个金融函数都整合到SAS9.2 Base中去了），正好可以慢慢道来，从新增的期权定价函数开始（以前这些函数在SAS的风险管理软件Risk Dimension里面）。  
SAS9.2 Base新增的这些定价函数（8个）都是计算欧式期权价格的，对看涨(call)期权、看跌期权(put)以及不同的期权类型（股票期权、期货期权、货币期权、交换期权），分别提供了以下四种模型：
Black-Scholes model，传统的股票期权定价模型，见Fischer Black and Myron Scholes (1973)Black model，Black-Scholes model的扩展，针对期货期权，见Fischer Black(1976)，所以该模型又称作Black-76Garman-Kohlhagen model，外汇期权定价模型，见Mark Garman and Steven Kohlhagen(1983)Margrabe model，交换期权定价模型，见William Margrabe(1978)

SAS9.2期权定价函数一览：



    Model，定价模型
   Underlying,标的物
    函数（Call,看涨）
    函数（ Put，看跌）


Black model
Futures，期货
BLACKCLPRC
BLACKPTPRC


Black-Scholes model
Stock，股票
BLKSHCLPRC
BLKSHPTPRC


Garman-Kohlhagen model
Currency，货币
GARKHCLPRC
GARKHPTPRC


Margrabe model 
Exchange，资产交换
MARGRCLPRC
MARGRPTPRC



具体用法，见SAS9.2的在线帮助文档，Functions and CALL Routines by Category: Financial：http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000245860.htm
推荐一个网站，可以比较各种不同的期权定价模型：http://www.montegodata.co.uk/
下期预告：一个通吃的金融函数，Finance(.)
一个孤零零的金融函数，能够做52种（是52种！）不同的金融计算，前面提到的SAS9.1/ETS那9个金融函数就是被它给硬生生消化掉了，……
del.icio.us Tags: SAS,Base,ETS,SAS9.2,Financial Functions,Options,Call,Put,Pricing,Black-Scholes model,Black model,Black-76,Garman-Kohlhagen model,Margrabe model,Futures Option,Stock Option,Currency Option,Exchange Option,金融函数,期权,定价,股票期权,期货期权,货币期权,交换期权,金融工程,Risk Dimension
]]></description>
			<content:encoded><![CDATA[<p>以前贴过一份<a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!333.entry" target="_blank">SAS9.1 Base的金融函数</a>（23个。SAS9.1/ETS还有9个），惜乎没有展开来讲。现在SAS9.2 Base新增了一些有意思的金融函数（还有一些调整，比如，SAS9.1/ETS那9个金融函数都整合到SAS9.2 Base中去了），正好可以慢慢道来，从新增的期权定价函数开始（以前这些函数在SAS的风险管理软件Risk Dimension里面）。  </p>
<p>SAS9.2 Base新增的这些定价函数（8个）都是计算欧式期权价格的，对看涨(call)期权、看跌期权(put)以及不同的期权类型（股票期权、期货期权、货币期权、交换期权），分别提供了以下四种模型：</p>
<blockquote><p><a href="http://en.wikipedia.org/wiki/Black-Scholes" target="_blank">Black-Scholes model</a>，传统的股票期权定价模型，见<a href="http://riem.swufe.edu.cn/new/techupload/course/200742423245359181.pdf" target="_blank">Fischer Black and Myron Scholes (1973)</a><br /><a href="http://en.wikipedia.org/wiki/Black_model" target="_blank">Black model</a>，Black-Scholes model的扩展，针对期货期权，见<a href="http://math.ucalgary.ca/~ware/jc/black76_slides.pdf" target="_blank">Fischer Black(1976)</a>，所以该模型又称作Black-76<br /><a href="http://www.riskglossary.com/link/garman_kohlhagen_1983.htm" target="_blank">Garman-Kohlhagen model</a>，外汇期权定价模型，见<a href="http://ideas.repec.org/a/eee/jimfin/v2y1983i3p231-237.html" target="_blank">Mark Garman and Steven Kohlhagen(1983)</a><br /><a href="http://www.sitmo.com/eq/671" target="_blank">Margrabe model</a>，交换期权定价模型，见<a href="http://www.er.ethz.ch/teaching/Margrabe_Option.pdf" target="_blank">William Margrabe(1978)</a></p>
</blockquote>
<p>SAS9.2期权定价函数一览：</p>
<table cellspacing="0" cellpadding="2" width="586" border="0">
<tbody>
<tr>
<td valign="top" width="151">    Model，定价模型</td>
<td valign="top" width="150">   Underlying,标的物</td>
<td valign="top" width="141">    函数（Call,看涨）</td>
<td valign="top" width="142">    函数（ Put，看跌）</td>
</tr>
<tr>
<td valign="top" width="149">Black model</td>
<td valign="top" width="150">Futures，期货</td>
<td valign="top" width="142">BLACK<font color="#ff0000">CL</font>PRC</td>
<td valign="top" width="142">BLACK<font color="#ff0000">PT</font>PRC</td>
</tr>
<tr>
<td valign="top" width="149">Black-Scholes model</td>
<td valign="top" width="150">Stock，股票</td>
<td valign="top" width="143">BLKSH<font color="#ff0000">CL</font>PRC</td>
<td valign="top" width="142">BLKSH<font color="#ff0000">PT</font>PRC</td>
</tr>
<tr>
<td valign="top" width="149">Garman-Kohlhagen model</td>
<td valign="top" width="149">Currency，货币</td>
<td valign="top" width="144">GARKH<font color="#ff0000">CL</font>PRC</td>
<td valign="top" width="142">GARKH<font color="#ff0000">PT</font>PRC</td>
</tr>
<tr>
<td valign="top" width="149">Margrabe model </td>
<td valign="top" width="149">Exchange，资产交换</td>
<td valign="top" width="144">MARGR<font color="#ff0000">CL</font>PRC</td>
<td valign="top" width="142">MARGR<font color="#ff0000">PT</font>PRC</td>
</tr>
</tbody>
</table>
<p>具体用法，见SAS9.2的在线帮助文档，<em>Functions and CALL Routines by Category: Financial</em>：<br /><a href="http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000245860.htm">http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000245860.htm</a></p>
<p>推荐一个网站，可以比较各种不同的期权定价模型：<a title="http://www.montegodata.co.uk/" href="http://www.montegodata.co.uk/">http://www.montegodata.co.uk/</a></p>
<p><strong>下期预告：一个通吃的金融函数，Finance(.)</strong></p>
<p>一个孤零零的金融函数，能够做52种（是52种！）不同的金融计算，前面提到的SAS9.1/ETS那9个金融函数就是被它给硬生生消化掉了，……</p>
<div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px">del.icio.us Tags: <a href="http://del.icio.us/popular/SAS" rel="tag">SAS</a>,<a href="http://del.icio.us/popular/Base" rel="tag">Base</a>,<a href="http://del.icio.us/popular/ETS" rel="tag">ETS</a>,<a href="http://del.icio.us/popular/SAS9.2" rel="tag">SAS9.2</a>,<a href="http://del.icio.us/popular/Financial Functions" rel="tag">Financial Functions</a>,<a href="http://del.icio.us/popular/Options" rel="tag">Options</a>,<a href="http://del.icio.us/popular/Call" rel="tag">Call</a>,<a href="http://del.icio.us/popular/Put" rel="tag">Put</a>,<a href="http://del.icio.us/popular/Pricing" rel="tag">Pricing</a>,<a href="http://del.icio.us/popular/Black-Scholes model" rel="tag">Black-Scholes model</a>,<a href="http://del.icio.us/popular/Black model" rel="tag">Black model</a>,<a href="http://del.icio.us/popular/Black-76" rel="tag">Black-76</a>,<a href="http://del.icio.us/popular/Garman-Kohlhagen model" rel="tag">Garman-Kohlhagen model</a>,<a href="http://del.icio.us/popular/Margrabe model" rel="tag">Margrabe model</a>,<a href="http://del.icio.us/popular/Futures Option" rel="tag">Futures Option</a>,<a href="http://del.icio.us/popular/Stock Option" rel="tag">Stock Option</a>,<a href="http://del.icio.us/popular/Currency Option" rel="tag">Currency Option</a>,<a href="http://del.icio.us/popular/Exchange Option" rel="tag">Exchange Option</a>,<a href="http://del.icio.us/popular/%e9%87%91%e8%9e%8d%e5%87%bd%e6%95%b0" rel="tag">金融函数</a>,<a href="http://del.icio.us/popular/%e6%9c%9f%e6%9d%83" rel="tag">期权</a>,<a href="http://del.icio.us/popular/%e5%ae%9a%e4%bb%b7" rel="tag">定价</a>,<a href="http://del.icio.us/popular/%e8%82%a1%e7%a5%a8%e6%9c%9f%e6%9d%83" rel="tag">股票期权</a>,<a href="http://del.icio.us/popular/%e6%9c%9f%e8%b4%a7%e6%9c%9f%e6%9d%83" rel="tag">期货期权</a>,<a href="http://del.icio.us/popular/%e8%b4%a7%e5%b8%81%e6%9c%9f%e6%9d%83" rel="tag">货币期权</a>,<a href="http://del.icio.us/popular/%e4%ba%a4%e6%8d%a2%e6%9c%9f%e6%9d%83" rel="tag">交换期权</a>,<a href="http://del.icio.us/popular/%e9%87%91%e8%9e%8d%e5%b7%a5%e7%a8%8b" rel="tag">金融工程</a>,<a href="http://del.icio.us/popular/Risk Dimension" rel="tag">Risk Dimension</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2009/01/06/sas%e9%87%91%e8%9e%8d%e5%87%bd%e6%95%b0%ef%bc%881%ef%bc%89%ef%bc%9a%e6%9c%9f%e6%9d%83%e5%ae%9a%e4%bb%b7%ef%bc%88new-in-sas9-2-base%ef%bc%89/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SAS/IML，及其与R/S-Plus、SciLab/Matlab的比较（1）</title>
		<link>http://www.jiangtanghu.com/cn/2008/08/17/sasiml%ef%bc%8c%e5%8f%8a%e5%85%b6%e4%b8%8ers-plus%e3%80%81scilabmatlab%e7%9a%84%e6%af%94%e8%be%83%ef%bc%881%ef%bc%89/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/08/17/sasiml%ef%bc%8c%e5%8f%8a%e5%85%b6%e4%b8%8ers-plus%e3%80%81scilabmatlab%e7%9a%84%e6%af%94%e8%be%83%ef%bc%881%ef%bc%89/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9978</guid>
		<description><![CDATA[SAS的矩阵语言IML(Interactive Matrix Language)只可以处理二维表，数据类型不如R、Matlab等同类矩阵语言丰富，不过它对矩阵的表达和操纵能力一样厉害，而且与SAS程序和数据的相互访问通讯比较好，不妨一学。矩阵语言，看着也类似，下面就做个IML与R/S-Plus、SciLab/Matlab的比较（我手头只有R跟SciLab，以下的例子就用它们，这两个东西我不熟，不妨随时指正。）一句话，SAS/IML在定义矩阵时跟SciLab/Matlab差不多，在提取矩阵元素时跟R/S-Plus相近些：
1.定义矩阵 




定义矩阵
SAS/IML
R/S-Plus
SciLab/Matlab


标量
a={1} 或者a=1
a=1
a={1} 



重复a={2 2 2} 


a={[3] 2 } 


a=rep(2,3)

 


循环，1到100
a=1:100
 
a=1:100


循环，1到100，步长为2
a=do(1,100,2)
 

a=1:2:100



1*3行向量 
a={1 2 3}
a=array(c(1,2,3),dim=c(1,3))
a=[1 2 3]



3*1列向量


a={1,2,3} 


a=array(c(1,2,3),dim=c(3,1)) 


a=[1;2;3] or a={1;2;3}




2*3矩阵


b={1 2 3, 4 5 6 } 


a=array(c(1,2,3,4,5,6),dim=c(2,3)) 


b=[1 2 3; 4 5 6 ]




3*3单位阵 


c=I(3) 

 

a=eye(3,3)




2*3零矩阵  


d=J(2,3,0)

 

zeros(2,3)




2*3全一矩阵 


e=J(2,3,1) or J(2,3) 

 

a=ones(2,3)




2.矩阵操纵 




矩阵操纵
SAS/IML
R/S-Plus
SciLab/Matlab



2行3列，


b=a[2,3]


b=a[2,3] 


b=a(2,3)




所有行


a[2,] 


a[2,] 


b=a(2,:)




所有列 


a[,3]


a[,3] 


b=a(:,3)




均值


b=a[:] 

 

b=a(:) 所有元素



水平叠加（列相加）
a&#124;&#124;b
cbind(a,b)
c=[a,b]


垂直叠加（行相加）
a//b
rbind(a,b)
 


取最大
a&#60;&#62;b
pmax(a,b)
 


取最小
a&#62;&#60;b
pmin(a,b)
 



3.矩阵运算 




矩阵运算
SAS/IML
R/S-Plus
SciLab/Matlab



求逆 


inv（a）


inv(a)


inv(a)



行列式
det(a)
 
det(a)


秩
rank(a)
 
rank(a)


迹
trace(a)
 
trace(a)



元素相乘  


a#b


a*b


a.*b




元素幂  


a##b 


a^b


a.^b




幂


a**2=a*a

 

a^2=a*a




矩阵乘法 [...]]]></description>
			<content:encoded><![CDATA[<p>SAS的矩阵语言IML(<b>I</b>nteractive <b>M</b>atrix <b>L</b>anguage)只可以处理二维表，数据类型不如R、Matlab等同类矩阵语言丰富，不过它对矩阵的表达和操纵能力一样厉害，而且与SAS程序和数据的相互访问通讯比较好，不妨一学。矩阵语言，看着也类似，下面就做个IML与R/S-Plus、SciLab/Matlab的比较（我手头只有R跟SciLab，以下的例子就用它们，这两个东西我不熟，不妨随时指正。）一句话，SAS/IML在定义矩阵时跟SciLab/Matlab差不多，在提取矩阵元素时跟R/S-Plus相近些：</p>
<blockquote><p>1.定义矩阵 </p>
</blockquote>
<table cellspacing="0" cellpadding="2" width="657" border="1">
<tbody>
<tr>
<td valign="top" width="116">定义矩阵</td>
<td valign="top" width="130">SAS/IML</td>
<td valign="top" width="221">R/S-Plus</td>
<td valign="top" width="188">SciLab/Matlab</td>
</tr>
<tr>
<td valign="top" width="116">标量</td>
<td valign="top" width="131">a={1} 或者a=1</td>
<td valign="top" width="221">a=1</td>
<td valign="top" width="188">a={1} </td>
</tr>
<tr>
<td valign="top" width="116">
<p>重复a={2 2 2} </p>
</td>
<td valign="top" width="131">
<p>a={[3] 2 } </p>
</td>
<td valign="top" width="221">
<p>a=rep(2,3)</p>
</td>
<td valign="top" width="188"> </td>
</tr>
<tr>
<td valign="top" width="116">循环，1到100</td>
<td valign="top" width="131">a=1:100</td>
<td valign="top" width="221"> </td>
<td valign="top" width="188">a=1:100</td>
</tr>
<tr>
<td valign="top" width="116">循环，1到100，步长为2</td>
<td valign="top" width="131">a=do(1,100,2)</td>
<td valign="top" width="221"> </td>
<td valign="top" width="188">
<p>a=1:2:100</p>
</td>
</tr>
<tr>
<td valign="top" width="116">1*3行向量 </td>
<td valign="top" width="131">a={1 2 3}</td>
<td valign="top" width="221">a=array(c(1,2,3),dim=c(1,3))</td>
<td valign="top" width="188">a=[1 2 3]</td>
</tr>
<tr>
<td valign="top" width="116">
<p>3*1列向量</p>
</td>
<td valign="top" width="131">
<p>a={1,2,3} </p>
</td>
<td valign="top" width="221">
<p>a=array(c(1,2,3),dim=c(3,1)) </p>
</td>
<td valign="top" width="188">
<p>a=[1;2;3] or a={1;2;3}</p>
</td>
</tr>
<tr>
<td valign="top" width="116">
<p>2*3矩阵</p>
</td>
<td valign="top" width="131">
<p>b={1 2 3, 4 5 6 } </p>
</td>
<td valign="top" width="221">
<p>a=array(c(1,2,3,4,5,6),dim=c(2,3)) </p>
</td>
<td valign="top" width="188">
<p>b=[1 2 3; 4 5 6 ]</p>
</td>
</tr>
<tr>
<td valign="top" width="116">
<p>3*3单位阵 </p>
</td>
<td valign="top" width="131">
<p>c=I(3) </p>
</td>
<td valign="top" width="221"> </td>
<td valign="top" width="188">
<p>a=eye(3,3)</p>
</td>
</tr>
<tr>
<td valign="top" width="116">
<p>2*3零矩阵  </p>
</td>
<td valign="top" width="131">
<p>d=J(2,3,0)</p>
</td>
<td valign="top" width="221"> </td>
<td valign="top" width="188">
<p>zeros(2,3)</p>
</td>
</tr>
<tr>
<td valign="top" width="116">
<p>2*3全一矩阵 </p>
</td>
<td valign="top" width="131">
<p>e=J(2,3,1) or J(2,3) </p>
</td>
<td valign="top" width="221"> </td>
<td valign="top" width="188">
<p>a=ones(2,3)</p>
</td>
</tr>
</tbody>
</table>
<blockquote><p>2.矩阵操纵 </p>
</blockquote>
<table cellspacing="0" cellpadding="2" width="402" border="1">
<tbody>
<tr>
<td valign="top" width="97">矩阵操纵</td>
<td valign="top" width="100">SAS/IML</td>
<td valign="top" width="98">R/S-Plus</td>
<td valign="top" width="105">SciLab/Matlab</td>
</tr>
<tr>
<td valign="top" width="95">
<p>2行3列，</p>
</td>
<td valign="top" width="99">
<p>b=a[2,3]</p>
</td>
<td valign="top" width="97">
<p>b=a[2,3] </p>
</td>
<td valign="top" width="109">
<p>b=a(2,3)</p>
</td>
</tr>
<tr>
<td valign="top" width="95">
<p>所有行</p>
</td>
<td valign="top" width="98">
<p>a[2,] </p>
</td>
<td valign="top" width="95">
<p>a[2,] </p>
</td>
<td valign="top" width="112">
<p>b=a(2,:)</p>
</td>
</tr>
<tr>
<td valign="top" width="93">
<p>所有列 </p>
</td>
<td valign="top" width="98">
<p>a[,3]</p>
</td>
<td valign="top" width="95">
<p>a[,3] </p>
</td>
<td valign="top" width="114">
<p>b=a(:,3)</p>
</td>
</tr>
<tr>
<td valign="top" width="93">
<p>均值</p>
</td>
<td valign="top" width="97">
<p>b=a[:] </p>
</td>
<td valign="top" width="94"> </td>
<td valign="top" width="116">
<p><font color="#ff0000">b=a(:) 所有元素</font></p>
</td>
</tr>
<tr>
<td valign="top" width="92">水平叠加（列相加）</td>
<td valign="top" width="97">a||b</td>
<td valign="top" width="94">cbind(a,b)</td>
<td valign="top" width="117">c=[a,b]</td>
</tr>
<tr>
<td valign="top" width="92">垂直叠加（行相加）</td>
<td valign="top" width="97">a//b</td>
<td valign="top" width="93">rbind(a,b)</td>
<td valign="top" width="118"> </td>
</tr>
<tr>
<td valign="top" width="92">取最大</td>
<td valign="top" width="97">a&lt;&gt;b</td>
<td valign="top" width="93">pmax(a,b)</td>
<td valign="top" width="118"> </td>
</tr>
<tr>
<td valign="top" width="92">取最小</td>
<td valign="top" width="97">a&gt;&lt;b</td>
<td valign="top" width="94">pmin(a,b)</td>
<td valign="top" width="119"> </td>
</tr>
</tbody>
</table>
<blockquote><p>3.矩阵运算 </p>
</blockquote>
<table cellspacing="0" cellpadding="2" width="561" border="1">
<tbody>
<tr>
<td valign="top" width="102">矩阵运算</td>
<td valign="top" width="102">SAS/IML</td>
<td valign="top" width="97">R/S-Plus</td>
<td valign="top" width="258">SciLab/Matlab</td>
</tr>
<tr>
<td valign="top" width="104">
<p>求逆 </p>
</td>
<td valign="top" width="103">
<p>inv（a）</p>
</td>
<td valign="top" width="96">
<p>inv(a)</p>
</td>
<td valign="top" width="256">
<p>inv(a)</p>
</td>
</tr>
<tr>
<td valign="top" width="107">行列式</td>
<td valign="top" width="104">det(a)</td>
<td valign="top" width="96"> </td>
<td valign="top" width="254">det(a)</td>
</tr>
<tr>
<td valign="top" width="108">秩</td>
<td valign="top" width="104">rank(a)</td>
<td valign="top" width="95"> </td>
<td valign="top" width="254">rank(a)</td>
</tr>
<tr>
<td valign="top" width="110">迹</td>
<td valign="top" width="104">trace(a)</td>
<td valign="top" width="95"> </td>
<td valign="top" width="253">trace(a)</td>
</tr>
<tr>
<td valign="top" width="111">
<p>元素相乘  </p>
</td>
<td valign="top" width="104">
<p>a#b</p>
</td>
<td valign="top" width="95">
<p>a*b</p>
</td>
<td valign="top" width="252">
<p>a.*b</p>
</td>
</tr>
<tr>
<td valign="top" width="112">
<p>元素幂  </p>
</td>
<td valign="top" width="104">
<p>a##b </p>
</td>
<td valign="top" width="95">
<p>a^b</p>
</td>
<td valign="top" width="252">
<p>a.^b</p>
</td>
</tr>
<tr>
<td valign="top" width="112">
<p>幂</p>
</td>
<td valign="top" width="104">
<p>a**2=a*a</p>
</td>
<td valign="top" width="95"> </td>
<td valign="top" width="252">
<p>a^2=a*a</p>
</td>
</tr>
<tr>
<td valign="top" width="112">
<p>矩阵乘法 </p>
</td>
<td valign="top" width="104">
<p>a*b </p>
</td>
<td valign="top" width="95">
<p>a%*%b</p>
</td>
<td valign="top" width="252"> </td>
</tr>
<tr>
<td valign="top" width="112">
<p>转置 </p>
</td>
<td valign="top" width="104">
<p>t(a) or a` </p>
</td>
<td valign="top" width="95">
<p>t(a)</p>
</td>
<td valign="top" width="252">
<p>a&#8217;</p>
</td>
</tr>
<tr>
<td valign="top" width="112">
<p>对角阵  </p>
</td>
<td valign="top" width="104">
<p>diag(a)</p>
</td>
<td valign="top" width="95">
<p>diag(a)</p>
</td>
<td valign="top" width="252"> </td>
</tr>
<tr>
<td valign="top" width="112">
<p>对角元素 </p>
</td>
<td valign="top" width="104">
<p>vecdiag(a) </p>
</td>
<td valign="top" width="95">
<p>diag(a)</p>
</td>
<td valign="top" width="252"> </td>
</tr>
<tr>
<td valign="top" width="112">Kronecker乘积</td>
<td valign="top" width="104">a@b</td>
<td valign="top" width="95"> </td>
<td valign="top" width="252">kron(m1,m2)</td>
</tr>
<tr>
<td valign="top" width="112">特征值<br />特征向量</td>
<td valign="top" width="104">eigval(a)<br />eigvec(a)</td>
<td valign="top" width="95"> </td>
<td valign="top" width="252">
<p>[eigenvector, eigenvalue]=eig(m) </p>
<p><font color="#ff0000">matlab </font></p>
</td>
</tr>
</tbody>
</table>
<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a>,<a href="http://technorati.<br />
com/tags/IML" rel="tag">IML</a>,<a href="http://technorati.com/tags/R" rel="tag">R</a>,<a href="http://technorati.com/tags/S-Plus" rel="tag">S-Plus</a>,<a href="http://technorati.com/tags/SciLab" rel="tag">SciLab</a>,<a href="http://technorati.com/tags/Matlab" rel="tag">Matlab</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/08/17/sasiml%ef%bc%8c%e5%8f%8a%e5%85%b6%e4%b8%8ers-plus%e3%80%81scilabmatlab%e7%9a%84%e6%af%94%e8%be%83%ef%bc%881%ef%bc%89/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SAS Perl Regular Expression and SAS Regular Expressions (2)</title>
		<link>http://www.jiangtanghu.com/cn/2008/07/08/sas-perl-regular-expression-and-sas-regular-expressions-2/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/07/08/sas-perl-regular-expression-and-sas-regular-expressions-2/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9975</guid>
		<description><![CDATA[可以先参考先前介绍正则表达式的元字符的那篇。
SAS对正则表达式 (Regular Expressions, RX) 的支持，表现在以下两大类函数（包括Call Routines）中：

SAS Perl Regular Expressions (PRX)，SAS9开始引进，有10个函数；  
SAS Regular Expressions (RX) ，SAS6.12就开始支持，5个函数。 

这两个正则表达式系统功能类似，只是语法略有差别。它们的对应如下： 



 
SAS Perl Regular Expressions
SAS Regular Expressions


版本
SAS9&#8211;
SAS6.12&#8211;


函数前缀
PRX
RX


定义正则表达式的函数
PRXParse
RXParse


定位函数
PRXMatch
RXMatch


 
Call PRXSubstr
Call RXSubstr


 
Call PRXPosn
 


 
Call PRXNext
 


 
PRXParen
 


文本替换函数
PRXChange
 


 
Call PRXChange
Call RXChange


释放内存函数
Call PRXFree
Call RXFree


代码调试函数
Call PRXDebug
 




在RX系统中，比如，用$d或$D来表示数字0-9，在PRX中，用\d，\D却表示所有不是数字的字符。同时学习两套系统很容易弄混。建议只使用SAS PRX。

PRX提供了更丰富的函数；  
PRX更为人所知；  
PRX据说更有效率。 

（待续……）
]]></description>
			<content:encoded><![CDATA[<p><em>可以先参考先前</em><a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!393.entry"><em>介绍正则表达式的元字符</em></a><em>的那篇。</em></p>
<p>SAS对正则表达式 (Regular Expressions, RX) 的支持，表现在以下两大类函数（包括Call Routines）中：</p>
<ol>
<li>SAS Perl Regular Expressions (PRX)，SAS9开始引进，有10个函数；  </li>
<li>SAS Regular Expressions (RX) ，SAS6.12就开始支持，5个函数。 </li>
</ol>
<p>这两个正则表达式系统功能类似，只是语法略有差别。它们的对应如下： </p>
<blockquote><table cellspacing="0" cellpadding="2" width="550" border="0">
<tbody>
<tr>
<td valign="top" width="130"> </td>
<td valign="top" width="202">SAS Perl Regular Expressions</td>
<td valign="top" width="215">SAS Regular Expressions</td>
</tr>
<tr>
<td valign="top" width="129">版本</td>
<td valign="top" width="202">SAS9&#8211;</td>
<td valign="top" width="215">SAS6.12&#8211;</td>
</tr>
<tr>
<td valign="top" width="128">函数前缀</td>
<td valign="top" width="202">PRX</td>
<td valign="top" width="215">RX</td>
</tr>
<tr>
<td valign="top" width="128">定义正则表达式的函数</td>
<td valign="top" width="202">PRXParse</td>
<td valign="top" width="215">RXParse</td>
</tr>
<tr>
<td valign="top" width="127">定位函数</td>
<td valign="top" width="202">PRXMatch</td>
<td valign="top" width="215">RXMatch</td>
</tr>
<tr>
<td valign="top" width="127"> </td>
<td valign="top" width="202">Call PRXSubstr</td>
<td valign="top" width="215">Call RXSubstr</td>
</tr>
<tr>
<td valign="top" width="126"> </td>
<td valign="top" width="202">Call PRXPosn</td>
<td valign="top" width="215"> </td>
</tr>
<tr>
<td valign="top" width="127"> </td>
<td valign="top" width="202">Call PRXNext</td>
<td valign="top" width="215"> </td>
</tr>
<tr>
<td valign="top" width="127"> </td>
<td valign="top" width="202">PRXParen</td>
<td valign="top" width="215"> </td>
</tr>
<tr>
<td valign="top" width="127">文本替换函数</td>
<td valign="top" width="202">PRXChange</td>
<td valign="top" width="215"> </td>
</tr>
<tr>
<td valign="top" width="127"> </td>
<td valign="top" width="202">Call PRXChange</td>
<td valign="top" width="215">Call RXChange</td>
</tr>
<tr>
<td valign="top" width="127">释放内存函数</td>
<td valign="top" width="202">Call PRXFree</td>
<td valign="top" width="215">Call RXFree</td>
</tr>
<tr>
<td valign="top" width="127">代码调试函数</td>
<td valign="top" width="202">Call PRXDebug</td>
<td valign="top" width="215"> </td>
</tr>
</tbody>
</table>
</blockquote>
<p>在RX系统中，比如，用$d或$D来表示数字0-9，在PRX中，用\d，\D却表示所有不是数字的字符。同时学习两套系统很容易弄混。建议只使用SAS PRX。</p>
<ol>
<li>PRX提供了更丰富的函数；  </li>
<li>PRX更为人所知；  </li>
<li>PRX据说更有效率。 </li>
</ol>
<p><i>（待续……）</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/07/08/sas-perl-regular-expression-and-sas-regular-expressions-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>在UltraEdit中运行SAS代码-配置图解</title>
		<link>http://www.jiangtanghu.com/cn/2008/05/01/%e5%9c%a8ultraedit%e4%b8%ad%e8%bf%90%e8%a1%8csas%e4%bb%a3%e7%a0%81-%e9%85%8d%e7%bd%ae%e5%9b%be%e8%a7%a3/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/05/01/%e5%9c%a8ultraedit%e4%b8%ad%e8%bf%90%e8%a1%8csas%e4%bb%a3%e7%a0%81-%e9%85%8d%e7%bd%ae%e5%9b%be%e8%a7%a3/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9974</guid>
		<description><![CDATA[在UltraEdit(UE)中编辑SAS代码是很方便的，尤其是同时查看很多不同的脚本时（关于在UE中实现SAS代码高亮显示，见文末）。以前有一篇《在UltraEdit中配置Java编译器》，现在说说如何在UltraEdit(UE)中配置SAS，不完全是玩具功能，偶尔有用。我的测试环境是：

UltraEdit Professional Version 14.00a+1 
SAS 9.1.3 Service Pack 4 
Microsoft Windows  XP Professional Version 2002, Service Pack 2 
Intel(R) Core(TM)2 Duo CPU, 1.95GB of RAM

1.UE-&#62;Advanced-&#62;Tool Configuration-&#62;Insert 
打开UE，依上面的顺序点击工具栏，你将看到类似下面的Command、Options和Output界面，先在Command栏目，Menu Item Name一栏，写上SAS或者其他能提醒自己的词，在Working Directory一栏填上%p。困难在于Command Line一栏，下面详述之。 
 
  
2.Start-&#62;All Programs-&#62;SAS-&#62;SAS 9.1(English)-&#62;Properties 
Command Line一栏涉及如何激活你的SAS系统。在你的机器里，依上点“开始”-&#62;“所有程序”等，你将看到如下对窗口： 
 
我们需要的Target（目标）一栏的字符串，我机器的SAS系统装在D盘，所以这一行是这样的：

D:\SAS9\sas.exe -CONFIG D:\SAS9\nls\1d\SASV9.CFG

把以上Target栏中的东西复制到上面提到的Command Line中，后面再加上这么些SAS系统选项（后面再解释）：

-noicon -nosplash -batch -sysin %n

所以，最后Command Line一栏看上去是这样的（注意：如果你的SAS系统装在其他路径，Target项目会有所不同）：

D:\SAS9\sas.exe -CONFIG D:\SAS9\nls\1d\SASV9.CFG  -noicon -nosplash -batch -sysin %n

3.Options [...]]]></description>
			<content:encoded><![CDATA[<p>在UltraEdit(UE)中编辑SAS代码是很方便的，尤其是同时查看很多不同的脚本时（关于在UE中实现SAS代码高亮显示，见文末）。以前有一篇《<a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!141.entry" target="_blank">在UltraEdit中配置Java编译器</a>》，现在说说如何在UltraEdit(UE)中配置SAS，不完全是玩具功能，偶尔有用。我的测试环境是：<br />
<blockquote>
<p>UltraEdit Professional Version 14.00a+1 </p>
<p>SAS 9.1.3 Service Pack 4 </p>
<p>Microsoft Windows  XP Professional Version 2002, Service Pack 2 </p>
<p>Intel(R) Core(TM)2 Duo CPU, 1.95GB of RAM</p>
</blockquote>
<p>1.UE-&gt;Advanced-&gt;Tool Configuration-&gt;Insert </p>
<p>打开UE，依上面的顺序点击工具栏，你将看到类似下面的Command、Options和Output界面，先在Command栏目，Menu Item Name一栏，写上SAS或者其他能提醒自己的词，在Working Directory一栏填上%p。困难在于Command Line一栏，下面详述之。 </p>
<p><a href="http://byfiles.storage.msn.com/y1pw_00XKRSxLzVd5aUzZlWM_T7JK_X-_6UmeulVviflDQB__QZQh9ieDRM6LOZM_KZg1JyA8idM6A?PARTNER=WRITER"><img style="border-width:0px" alt="Command" src="http://byfiles.storage.msn.com/y1pw_00XKRSxLzXcLPQNmWL1wRfZbqelgP-ThSHT08s11gs8MP7dQDFjqfFkwyRLxW2cUMVZn5T1Zc?PARTNER=WRITER" border="0" height="301" width="378" /></a> </p>
<p>  </p>
<p>2.Start-&gt;All Programs-&gt;SAS-&gt;SAS 9.1(English)-&gt;Properties </p>
<p>Command Line一栏涉及如何激活你的SAS系统。在你的机器里，依上点“开始”-&gt;“所有程序”等，你将看到如下对窗口： </p>
<p><a href="http://byfiles.storage.msn.com/y1pw_00XKRSxLzwQwfpfPKt_BdLsHPo7PdKFlitAupEz67hhuAqiFBzkbwmVcpM8BYI5c_LNYCYQtY?PARTNER=WRITER"><img style="border-width:0px" alt="Target" src="http://byfiles.storage.msn.com/y1pw_00XKRSxLwKkZU_48KqQECbtzXrEzDHxGRfEbdZj8M1uiea7NNiy1UzzAiP6IZBUAXKl0LnvYY?PARTNER=WRITER" border="0" height="377" width="377" /></a> </p>
<p>我们需要的Target（目标）一栏的字符串，我机器的SAS系统装在D盘，所以这一行是这样的：<br />
<blockquote>
<p>D:\SAS9\sas.exe -CONFIG D:\SAS9\nls\1d\SASV9.CFG</p>
</blockquote>
<p>把以上Target栏中的东西复制到上面提到的Command Line中，后面再加上这么些SAS系统选项（后面再解释）：<br />
<blockquote>
<p><code>-noicon -nosplash -batch -sysin %n</code></p>
</blockquote>
<p><code>所以，最后Command Line一栏看上去是这样的（<strong>注意</strong>：如果你的SAS系统装在其他路径，Target项目会有所不同）：</code><br />
<blockquote>
<p>D:\SAS9\sas.exe -CONFIG D:\SAS9\nls\1d\SASV9.CFG  <code>-noicon -nosplash -batch -sysin %n</code></p>
</blockquote>
<p>3.Options </p>
<p>在Options栏目里，勾上Windows Program和Save all files first。 </p>
<p><a href="http://byfiles.storage.msn.com/y1pw_00XKRSxLz9UuP5Z3DYOy72GkG8Ey3fGDRas_-jd3RRB6tQKcZx0Bs5h7PZ84MZ6dL16SFhtoE?PARTNER=WRITER"><img style="border-width:0px" alt="Options" src="http://byfiles.storage.msn.com/y1pw_00XKRSxLxZBqTZ4Iut-HB8TX2TO85cnG_Mnlfcvuv-s4IUhL-aE0-4sx7eOIH5SOKubmbzg8g?PARTNER=WRITER" border="0" height="345" width="399" /></a> </p>
<p>4.Output </p>
<p>在Output栏目里，勾上Output to List Box、Capture Output以及Captured Output。 </p>
<p><a href="http://byfiles.storage.msn.com/y1pw_00XKRSxLzt0MxF7r6epdpm3ja-_TQB_V4AAXtFGYIm87V5xE9sjwDIrQOzdyBepWRvBxp51gI?PARTNER=WRITER"><img style="border-width:0px" alt="Output" src="http://byfiles.storage.msn.com/y1pw_00XKRSxLyUmK49eRs8WdqggTHfz6MGq2j-1wdto4TKLDmnoQjhZ3ifSAVUwVUdyagoyRljgZI?PARTNER=WRITER" border="0" height="337" width="398" /></a> </p>
<p>按OK结束。在UE-&gt;Advanced的最下面，你将看到新建成功的SAS项目。大功告成哈尔莫斯。 </p>
<p>/*以上参考<a href="http://mcdc2.missouri.edu/jgb/sas9/usgnotes.html#Ultrabatch" target="_blank">Batch Submission Using Ultraedit</a>，里面UE和SAS的版本都很旧。*/ </p>
<p>  </p>
<p>随便在SAS Help找一段不是特简单的代码，比如下面的，把它们复制到UE，并保存为比如ultraedit.sas，路径在，比如D:\Ultreedit-SAS\，接下来所有的结果都会保存在这个路径下，而且在UE中点File-&gt;Open，也会直接到达这个所谓当前文件夹：<br />
<blockquote>
<p>data Setosa;  </p>
<p>        input SepalLength SepalWidth PetalLength PetalWidth @@;  </p>
<p>        label sepallength=&#8217;Sepal Length in mm.&#8217;  </p>
<p>              sepalwidth=&#8217;Sepal Width in mm.&#8217;  </p>
<p>              petallength=&#8217;Petal Length in mm.&#8217;  </p>
<p>              petalwidth=&#8217;Petal Width in mm.&#8217;;  </p>
<p>        datalines;  </p>
<p>      50 33 14 02  46 34 14 03  46 36 .  02  </p>
<p>      51 33 17 05  55 35 13 02  48 31 16 02  </p>
<p>      52 34 14 02  49 36 14 01  44 32 13 02  </p>
<p>      50 35 16 06  44 30 13 02  47 32 16 02  </p>
<p>      48 30 14 03  51 38 16 02  48 34 19 02  </p>
<p>      50 30 16 02  50 32 12 02  43 30 11 .  </p>
<p>      58 40 12 02  51 38 19 04  49 30 14 02  </p>
<p>      51 35 14 02  50 34 16 04  46 32 14 02  </p>
<p>      57 44 15 04  50 36 14 02  54 34 15 04  </p>
<p>      52 41 15 .   55 42 14 02  49 31 15 02  </p>
<p>      54 39 17 04  50 34 15 02  44 29 14 02  </p>
<p>      47 32 13 02  46 31 15 02  51 34 15 02  </p>
<p>      50 35 13 03  49 31 15 01  54 37 15 02  </p>
<p>      54 39 13 04  51 35 14 03  48 34 16 02  </p>
<p>      48 30 14 01  45 23 13 03  57 38 17 03  </p>
<p>      51 38 15 03  54 34 17 02  51 37 15 04  </p>
<p>      52 35 15 02  53 37 15 02  </p>
<p>      ;  </p>
<p>   ods html;  </p>
<p>   ods graphics on;  </p>
<p>   title &#8216;Fisher (1936) Iris Setosa Data&#8217;;  </p>
<p>   proc corr data=Setosa sscp cov plots;  </p>
<p>      var  sepallength sepalwidth;  </p>
<p>      with petallength petalwidth;  </p>
<p>   run;  </p>
<p>   ods graphics off;  </p>
<p>   ods html close;</p>
</blockquote>
<p>就在这段代码上，点Advanced-&gt;SAS 运行，稍等你就能在D:\Ultreedit-SAS看到所有的结果： </p>
<p><a href="http://k1w87q.bay.livefilestore.com/y1pohvC4hMwCjjpCFfzRyMFeOfvKMkaWLH3ZlIyLobD6_pJwmBYH7-rkP71-7z8lXf9g8PTeIy-NwOcU5k9xuvLLw?PARTNER=WRITER"><img style="border:0px none" alt="Result" src="http://by2.storage.msn.com/y1pH_4B0Rv9wcHrNNCpGX215f7H2gS23IimsDItWOomO6IOjq4nGAVwiDeOFNw8IaFw46siCV_CMhWB4TFeKHeuRwHgswHFWBeZ?PARTNER=WRITER" border="0" height="273" width="495" /></a> </p>
<p>其中，<br />
<blockquote>
<p>ultraedit.sas是我们测试的代码，在UE里编辑和运行；  </p>
<p>ultraedit.log 是这次任务的日志文件，可以用UE打开；  </p>
<p>ultraedit.lst 是list output，可以用UE打开,依次见下： </p>
<p><a href="http://k1w87q.bay.livefilestore.com/y1prDrT2FobR69a-NgHQlQrNCn17TqmV4RAsh5bEu6nl4vO3PgnqWq0QSkOeCX4Lm-6z0wydOMtXAJ_dXIjiIJifWf8gMfcvqrR?PARTNER=WRITER"><img style="border-width:0px" alt="LogList" src="http://by2.storage.msn.com/y1pH_4B0Rv9wcHR-3ihMKBrUKNY19qIvczeuUI9HjqL6zfRQcZtGHiSQp32Qmm91Vd5DqpBxrtlrU9jzWkgSWN3jwFTeiRgghTa?PARTNER=WRITER" border="0" height="356" width="566" /></a> </p>
<p>sashtml.htm 是html output，可以用默认的浏览器打开；  </p>
<p>RecMatrixPlot0.gif是上面程序产生的散点图图片。</p>
</blockquote>
<table border="0" cellpadding="2" cellspacing="0" width="400">
<tbody>
<tr>
<td valign="top" width="200"><a href="http://by2.storage.msn.com/y1pH_4B0Rv9wcEBRoSXupY6M3IUknlQ0mPx6Es7Z6cF8ehi3APUEykot8KgxhltPcIsUhVUyartgR7vO_dOEyh4I_1j6P2M9B3f?PARTNER=WRITER"><img style="border:0px none" alt="HtmlOutput" src="http://by2.storage.msn.com/y1pH_4B0Rv9wcEmUFT1kfYcRgynhm2YGoeUTSubpiLuTKvW_zHFQGIboBNnyIIkg5cfbOi3xR1AitT2lFqn4e42KYVjbHaiwmC9?PARTNER=WRITER" border="0" height="260" width="330" /></a> </td>
<td valign="top" width="200"><a href="http://k1w87q.bay.livefilestore.com/y1prDrT2FobR6_brTx2ypx-801oAidhhKzy6vm-3Wo9d-5JLdx-dB_SVEDfBNfZAzWx1lI92YJHk1-vIF-GODCWij8TJ9lPbCV7?PARTNER=WRITER"><img style="border:0px none" alt="Figure" src="http://by2.storage.msn.com/y1pH_4B0Rv9wcH47uHU1AsVP4qVtnE0jKM<br />
I9LsM7DJP0ccdmrxb5WKZoXny30csgZaL1IF7j42WcWTUVD18xIwpdYfNH52eMCGp?PARTNER=WRITER" border="0" height="259" width="367" /></a> </td>
</tr>
</tbody>
</table>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;附录&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;  </p>
<p>5.如果以上都没问题，那么我们就可以参详一下在以上设置中碰到的SAS系统选项：<br />
<blockquote>
<p>sysin-specifies to start the SAS System and submit the file in batch mode  </p>
<p>noicon-specifies to restore the main SAS window immediately  </p>
<p>nosplash-specifies to not display the logo screen when the SAS System initiates</p>
</blockquote>
<p>6.关于UE里SAS代码高亮显示，见<a title="http://idmcomp.com/index.php?name=Content&amp;pa=showpage&amp;pid=40" href="http://idmcomp.com/index.php?name=Content&amp;pa=showpage&amp;pid=40">http://idmcomp.com/index.php?name=Content&amp;pa=showpage&amp;pid=40</a>
<div style="margin:0px;padding:0px;display:inline">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a>,<a href="http://technorati.com/tags/Ultraedit" rel="tag">Ultraedit</a>,<a href="http://technorati.com/tags/Configutation" rel="tag">Configutation</a>,<a href="http://technorati.com/tags/highlighting" rel="tag">highlighting</a></div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/05/01/%e5%9c%a8ultraedit%e4%b8%ad%e8%bf%90%e8%a1%8csas%e4%bb%a3%e7%a0%81-%e9%85%8d%e7%bd%ae%e5%9b%be%e8%a7%a3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SAS Tips &amp; Chicks: 在几个编辑窗口的切换</title>
		<link>http://www.jiangtanghu.com/cn/2008/03/14/sas-tips-chicks-%e5%9c%a8%e5%87%a0%e4%b8%aa%e7%bc%96%e8%be%91%e7%aa%97%e5%8f%a3%e7%9a%84%e5%88%87%e6%8d%a2/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/03/14/sas-tips-chicks-%e5%9c%a8%e5%87%a0%e4%b8%aa%e7%bc%96%e8%be%91%e7%aa%97%e5%8f%a3%e7%9a%84%e5%88%87%e6%8d%a2/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9972</guid>
		<description><![CDATA[好久没更新，先贴一个小东西，稍些改变一下这空间里的萧条气氛。前些日子有个网友问：
这里我有一个小问题，我在sas里面同时会编写很多程序，但是不知道如何用快捷键在这些编辑界面中切换，我不得不开好几个sas然后用Alt+Tab来切换，这样很麻烦，不知道你有什么tip么？

答曰：

打开一个SAS.exe。在增强型编辑器里，默认的窗口名为Untitled1，可以不断使用快捷键ctrl+n，这样就能在一个SAS.exe里同时打开很多编辑器窗口，分别是Untitled2、Untitled3、Untitled4之类。  
切换。在各个Untitled中，用快捷键ctrl+tab就可以相互切换，试一下。

]]></description>
			<content:encoded><![CDATA[<p>好久没更新，先贴一个小东西，稍些改变一下这空间里的萧条气氛。前些日子有个网友问：</p>
<blockquote><p>这里我有一个小问题，我在sas里面同时会编写很多程序，但是不知道如何用快捷键在这些编辑界面中切换，我不得不开好几个sas然后用Alt+Tab来切换，这样很麻烦，不知道你有什么tip么？</p>
</blockquote>
<p>答曰：</p>
<ol>
<li>打开<b>一个</b>SAS.exe。在增强型编辑器里，默认的窗口名为Untitled1，可以不断使用快捷键ctrl+n，这样就能在一个SAS.exe里同时打开很多编辑器窗口，分别是Untitled2、Untitled3、Untitled4之类。  </li>
<li>切换。在各个Untitled中，用快捷键ctrl+tab就可以相互切换，试一下。</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/03/14/sas-tips-chicks-%e5%9c%a8%e5%87%a0%e4%b8%aa%e7%bc%96%e8%be%91%e7%aa%97%e5%8f%a3%e7%9a%84%e5%88%87%e6%8d%a2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAS在TIOBE的最近排名</title>
		<link>http://www.jiangtanghu.com/cn/2008/03/05/sas%e5%9c%a8tiobe%e7%9a%84%e6%9c%80%e8%bf%91%e6%8e%92%e5%90%8d/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/03/05/sas%e5%9c%a8tiobe%e7%9a%84%e6%9c%80%e8%bf%91%e6%8e%92%e5%90%8d/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9971</guid>
		<description><![CDATA[TIOBE程序语言排名是各种语言流行程度的指标，每月更新。它的评分是参考全球范围内的技术工程师、讲师以及第三方厂商的意见，通过google、MSN、Yahoo!等常用的搜索引擎来计算每种程序设计语言的流行指数。TIOBE排行榜是程序员查看自己掌握的编程技能是否过时的权威参考。具体的评分标准，可以参阅其官分评分文档。现在最新的排行榜是（前20名，2008年3月）：
  
 只是些细微的月度变化，通用编程语言还是Java、C\C++，脚本语言还是3P（PHP、Perl、Python）的天下。上面把Delphi和Pascal单列，无疑削弱了Pascal的排名。SQL的扩展语言PL/SQL入榜，表明了Oracle管理员和程序员在数据库领域的地位（SQL不是TIOBE定义的编程语言，PL/SQL才是过程式的程序语言）。上面还有一个有趣的语言就是COBOL，最近似乎有兴起之势，有兴趣可以读读这篇《一个COBOL程序员的自白》。接下来我感兴趣的是SAS。
SAS这个月的排名是14，去年同期的排名是11，不过还保持了上两个月内评分超过0.7%的增长率，因此还有A-的评分。SAS排名的变动如下：
 
波动是够大的，不过总体的上升趋势还是比较明显。大致地，01年比较平淡，02年降些，03年又有极大的拉升，04年初有减弱现象，不过把一个相对高的分数带给了05年，然后整个05年就在一个水平波动，整个06是SAS最被关注的时候，而整个07年就一直走下坡路。今年年初，SAS的被关注程度还在往下跌，不过按着以前的模式，SAS在年初的表现一般都不怎么惹人注目。现在SAS的被关注程度正处于谷底，整个08年排名的上升趋势还是挺乐观的。以上展示的是逐月波动，对照一下同期其他流行语言的情况，你对类似波动的理解就会全面些：



 
 



顺便提一下，现在这个排行榜，Fortran是24名，Matlab是26，R是45，Maple、Mathematica、SPSS的排名更在50之外。
Technorati Tags: SAS,TIOBE
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html" target="_blank">TIOBE</a>程序语言排名是各种语言流行程度的指标，每月更新。它的评分是参考全球范围内的技术工程师、讲师以及第三方厂商的意见，通过google、MSN、Yahoo!等常用的搜索引擎来计算每种程序设计语言的流行指数。TIOBE排行榜是程序员查看自己掌握的编程技能是否过时的权威参考。具体的评分标准，可以参阅其<a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/tpci_definition.htm" target="_blank">官分评分文档</a>。现在最新的排行榜是（前20名，2008年3月）：</p>
<p> <a href="http://byfiles.storage.msn.com/y1pw_00XKRSxLzEPjeiWieRhNmntDwiQ0CTnLdepLpbFJScbBdhLnes5ShNVEfrpbLW47I1OWE8nXs?PARTNER=WRITER"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height="432" alt="ti" src="http://byfiles.storage.msn.com/y1pw_00XKRSxLxpnK2VzBDc3fMVAKW7l3PFOWR2TuR29RbiNzxACStnP9yty9JQdfeAoaAthEx621E?PARTNER=WRITER" width="508" border="0" /></a> </p>
<p> 只是些细微的月度变化，通用编程语言还是Java、C\C++，脚本语言还是3P（PHP、Perl、Python）的天下。上面把Delphi和Pascal单列，无疑削弱了Pascal的排名。SQL的扩展语言PL/SQL入榜，表明了Oracle管理员和程序员在数据库领域的地位（SQL不是TIOBE定义的编程语言，PL/SQL才是过程式的程序语言）。上面还有一个有趣的语言就是COBOL，最近似乎有兴起之势，有兴趣可以读读这篇《<a href="http://www.cnbeta.com/articles/49726.htm" target="_blank">一个COBOL程序员的自白</a>》。接下来我感兴趣的是SAS。</p>
<p>SAS这个月的排名是14，去年同期的排名是11，不过还保持了上两个月内评分超过0.7%的增长率，因此还有A-的评分。SAS排名的变动如下：</p>
<p><a href="http://k1w87q.bay.livefilestore.com/y1pohvC4hMwCjhnp7AFZxdLramYA9ndqA6ERQ_R7xhQRkmvplpc14ieNnPoR6QAdxVKnUNRFdGL8YxG2k-6tFhFeA?PARTNER=WRITER"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height="359" alt="history_SAS" src="http://by1.storage.msn.com/y1pH_4B0Rv9wcHdEjnPq616dnM0yJ8cWpBKO2fFT_2ZrWkYBTi8Vxd9EY6Y4oZ7xGQrda6i0cM2YVToqol9g8NHmWHgZoSK6LTU?PARTNER=WRITER" width="563" border="0" /></a> </p>
<p>波动是够大的，不过总体的上升趋势还是比较明显。大致地，01年比较平淡，02年降些，03年又有极大的拉升，04年初有减弱现象，不过把一个相对高的分数带给了05年，然后整个05年就在一个水平波动，整个06是SAS最被关注的时候，而整个07年就一直走下坡路。今年年初，SAS的被关注程度还在往下跌，不过按着以前的模式，SAS在年初的表现一般都不怎么惹人注目。现在SAS的被关注程度正处于谷底，整个08年排名的上升趋势还是挺乐观的。以上展示的是逐月波动，对照一下同期其他流行语言的情况，你对类似波动的理解就会全面些：</p>
<table cellspacing="0" cellpadding="2" width="549" border="0">
<tbody>
<tr>
<td valign="top" width="252"><a href="http://k1w87q.bay.livefilestore.com/y1prDrT2FobR6-nkKC07x8JZiXj7-GyNfg0jLUZ1l-5B9YhQMeut2tpk_YDnmoIUSH1sAoYDGkHufVZfMcjvd8Usyd1bXR05faj?PARTNER=WRITER"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height="291" alt="history_Java" src="http://by1.storage.msn.com/y1pH_4B0Rv9wcHP1ulukjHUOhUrTVNP26HX_qU1vgXmSoRGiUGpE6dABSA4x1dQjqJ841YRWEGwjwQTIQxpGz3Fe6AGqt6tLmg6?PARTNER=WRITER" width="317" border="0" /></a> </td>
<td valign="top" width="295"><a href="http://k1w87q.bay.livefilestore.com/y1prDrT2FobR68XHRpMfeDwnjK7a3qog269BkCjVcWzmJwBGP0Q7GPe4Cvu30GNg5__Zmf8bAQIbBGeVqlbJiiFOdtqNGCS2uDY?PARTNER=WRITER"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height="291" alt="history_Perl" src="http://by1.storage.msn.com/y1pH_4B0Rv9wcG5ykfyur6yo8kEItpIN2v2DEK8mxWs9yn0CF4WLCVTPIXP8AQzpaYWTdTx6fymVjtbtJTEcTzrpCEWGNGJxWZV?PARTNER=WRITER" width="323" border="0" /></a> </td>
</tr>
</tbody>
</table>
<p>顺便提一下，现在这个排行榜，Fortran是24名，Matlab是26，R是45，Maple、Mathematica、SPSS的排名更在50之外。</p>
<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a>,<a href="http://technorati.com/tags/TIOBE" rel="tag">TIOBE</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/03/05/sas%e5%9c%a8tiobe%e7%9a%84%e6%9c%80%e8%bf%91%e6%8e%92%e5%90%8d/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SAS Tips &amp; Chicks: 笛卡尔乘积、求连续数列的累积和</title>
		<link>http://www.jiangtanghu.com/cn/2008/02/26/sas-tips-chicks-%e7%ac%9b%e5%8d%a1%e5%b0%94%e4%b9%98%e7%a7%af%e3%80%81%e6%b1%82%e8%bf%9e%e7%bb%ad%e6%95%b0%e5%88%97%e7%9a%84%e7%b4%af%e7%a7%af%e5%92%8c/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/02/26/sas-tips-chicks-%e7%ac%9b%e5%8d%a1%e5%b0%94%e4%b9%98%e7%a7%af%e3%80%81%e6%b1%82%e8%bf%9e%e7%bb%ad%e6%95%b0%e5%88%97%e7%9a%84%e7%b4%af%e7%a7%af%e5%92%8c/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9970</guid>
		<description><![CDATA[笛卡尔乘积(Cartesian Product)返回几个集合中所有元素的组合情况。比如数据a中存有3种车型的数据，数据b中存有两种可能的颜色，则笛卡尔乘积运算则返回3×2=6种可能的排列，新的数据看起来像这个样子：

Obs    car    color  
1      a       A2      a       B3      b       A4      b       B5      c       A6      c       B 

两种解决方案，一是data步：

data a;    input car$;cards;abc;
data b;    input color$;cards;AB; 
data ab;    set a;    do i=1 to n;        set b point=i nobs=n;        output;    end;run;proc print data=ab;run;

proc sql可能会直观些：

proc sql;    create table ab2 as        select a.*,b.color        from a,b;quit;proc print data=ab2;run;

又，SAS求职者面试中一道传统的题就是，求一个连续数列的累计和，比如求1到100中所有奇数的和。两个直观的解答是：

data a;    do [...]]]></description>
			<content:encoded><![CDATA[<p><strong>笛卡尔乘积</strong>(Cartesian Product)返回几个集合中所有元素的组合情况。比如数据a中存有3种车型的数据，数据b中存有两种可能的颜色，则笛卡尔乘积运算则返回3×2=6种可能的排列，新的数据看起来像这个样子：<br />
<blockquote>
<p>Obs    car    color  </p>
<p>1      a       A<br />2      a       B<br />3      b       A<br />4      b       B<br />5      c       A<br />6      c       B </p>
</blockquote>
<p>两种解决方案，一是data步：<br />
<blockquote>
<p>data a;<br />    input car$;<br />cards;<br />a<br />b<br />c<br />;</p>
<p>data b;<br />    input color$;<br />cards;<br />A<br />B<br />; </p>
<p>data ab;<br />    set a;<br />    do i=1 to n;<br />        set b point=i nobs=n;<br />        output;<br />    end;<br />run;<br />proc print data=ab;run;</p>
</blockquote>
<p>proc sql可能会直观些：<br />
<blockquote>
<p>proc sql;<br />    create table ab2 as<br />        select a.*,b.color<br />        from a,b;<br />quit;<br />proc print data=ab2;run;</p>
</blockquote>
<p>又，SAS求职者面试中一道传统的题就是，<strong>求一个连续数列的累计和</strong>，比如求1到100中所有奇数的和。两个直观的解答是：<br />
<blockquote>
<p>data a;<br />    do i=1 to 10;<br />        *retain j 0;<br />        if mod(i,2) ne 0 then j=sum(j,i);<br />        if mod(i,2) ne 0 then output;        <br />    end;<br />run;  </p>
<p>data b;<br />    do i=1 to 10 by 2;<br />        j+i;<br />        output;<br />    end;<br />run; </p>
</blockquote>
<p>这里值得一提的是第二种解答中，用了一个SAS专用的求和语句“<strong>变量名+表达式</strong>”(j+i)。这个求和语句的好处就是它集成了retain语句和sum函数的一些功能，而且使赋值语句更为简洁。</p>
<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a>,<a href="http://technorati.com/tags/%e7%ac%9b%e5%8d%a1%e5%b0%94%e4%b9%98%e7%a7%af" rel="tag">笛卡尔乘积</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/02/26/sas-tips-chicks-%e7%ac%9b%e5%8d%a1%e5%b0%94%e4%b9%98%e7%a7%af%e3%80%81%e6%b1%82%e8%bf%9e%e7%bb%ad%e6%95%b0%e5%88%97%e7%9a%84%e7%b4%af%e7%a7%af%e5%92%8c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAS与Perl正则表达式（1）：元字符</title>
		<link>http://www.jiangtanghu.com/cn/2008/02/24/sas%e4%b8%8eperl%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%ef%bc%881%ef%bc%89%ef%bc%9a%e5%85%83%e5%ad%97%e7%ac%a6/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/02/24/sas%e4%b8%8eperl%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%ef%bc%881%ef%bc%89%ef%bc%9a%e5%85%83%e5%ad%97%e7%ac%a6/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9968</guid>
		<description><![CDATA[基本元字符



元字符 
含义 
举例 


/. . ./ 
一个正则表达式的起止 
position=prxMatch(&#8216;/world/&#8216;,&#8217;Hello World&#8217;) 


&#124; 
数项之间的一个选择，“或”运算 
x&#124;y匹配x或者y 


() 
匹配组。标记一个子表达式的开始和结束位置。相关匹配将被缓存，供以后使用 
比如，输入字符串为  abc1 dce2 fg，则 ([a-z]{3}\d) 将产生两次匹配，abc1和dce2 



  
匹配字符



元字符 
匹配的字符 
举例 
备注 


. 
除换行符(newline)以外的任一字符 
  
要匹配包括换行符的任一字符，使用模式[.\n] 


\w 
任一单词字符，包括A-Z,a-z,0-9和下划线(underscore,_) 
  
在英语中，等价于[A-Za-z0-9_] 


\W 
任一非单词字符 
\W可以匹配@  
在英语中，等价于[^A-Za-z0-9_] 


\s 
任一空白字符，包括空格(space)、制表符(tab)、换行符、回车符、中文全角空格等 
  
等价于[\f\n\r\t\v] 


\S 
任一非空白字符 
  
等价于[^\f\n\r\t\v] 


\d 
0-9任一数字 
\d\d可以匹配34 
等价于[0-9] 


\D 
任一非数字字符 
\D\D\D可以匹配abc  
等价于[^0-9]



]]></description>
			<content:encoded><![CDATA[<p>基本元字符<br />
<table border="0" cellpadding="2" cellspacing="0" width="620">
<tbody>
<tr>
<td valign="top" width="112">元字符 </td>
<td valign="top" width="222">含义 </td>
<td valign="top" width="284">举例 </td>
</tr>
<tr>
<td valign="top" width="111">/. . ./ </td>
<td valign="top" width="221">一个正则表达式的起止 </td>
<td valign="top" width="284">position=prxMatch(&#8216;<font color="#ff0000">/</font>world<font color="#ff0000">/</font>&#8216;,&#8217;Hello World&#8217;) </td>
</tr>
<tr>
<td valign="top" width="111">| </td>
<td valign="top" width="220">数项之间的一个选择，“或”运算 </td>
<td valign="top" width="284">x<font color="#ff0000">|</font>y匹配x或者y </td>
</tr>
<tr>
<td valign="top" width="111">() </td>
<td valign="top" width="219">匹配组。标记一个子表达式的开始和结束位置。相关匹配将被缓存，供以后使用 </td>
<td valign="top" width="284">比如，输入字符串为  abc1 dce2 fg，则 <font color="#ff0000">(</font>[a-z]{3}\d<font color="#ff0000">)</font> 将产生两次匹配，abc1和dce2 </td>
</tr>
</tbody>
</table>
<p>  </p>
<p>匹配字符<br />
<table border="0" cellpadding="2" cellspacing="0" width="638">
<tbody>
<tr>
<td valign="top" width="76">元字符 </td>
<td valign="top" width="222">匹配的字符 </td>
<td valign="top" width="110">举例 </td>
<td valign="top" width="231">备注 </td>
</tr>
<tr>
<td valign="top" width="76">. </td>
<td valign="top" width="221">除换行符(newline)以外的任一字符 </td>
<td valign="top" width="110">  </td>
<td valign="top" width="231">要匹配包括换行符的任一字符，使用模式[<font color="#ff0000">.</font>\n] </td>
</tr>
<tr>
<td valign="top" width="76">\w </td>
<td valign="top" width="220">任一单词字符，包括A-Z,a-z,0-9和下划线(underscore,_) </td>
<td valign="top" width="110">  </td>
<td valign="top" width="231">在英语中，等价于[A-Za-z0-9_] </td>
</tr>
<tr>
<td valign="top" width="75">\W </td>
<td valign="top" width="219">任一非单词字符 </td>
<td valign="top" width="110">\W可以匹配@  </td>
<td valign="top" width="231">在英语中，等价于[^A-Za-z0-9_] </td>
</tr>
<tr>
<td valign="top" width="74">\s </td>
<td valign="top" width="219">任一空白字符，包括空格(space)、制表符(tab)、换行符、回车符、中文全角空格等 </td>
<td valign="top" width="110">  </td>
<td valign="top" width="231">等价于[\f\n\r\t\v] </td>
</tr>
<tr>
<td valign="top" width="74">\S </td>
<td valign="top" width="218">任一非空白字符 </td>
<td valign="top" width="110">  </td>
<td valign="top" width="231">等价于[^\f\n\r\t\v] </td>
</tr>
<tr>
<td valign="top" width="74">\d </td>
<td valign="top" width="217">0-9任一数字 </td>
<td valign="top" width="110">\d\d可以匹配34 </td>
<td valign="top" width="231">等价于[0-9] </td>
</tr>
<tr>
<td valign="top" width="74">\D </td>
<td valign="top" width="218">任一非数字字符 </td>
<td valign="top" width="110">\D\D\D可以匹配abc  </td>
<td valign="top" width="231">等价于[^0-9]</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/02/24/sas%e4%b8%8eperl%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%ef%bc%881%ef%bc%89%ef%bc%9a%e5%85%83%e5%ad%97%e7%ac%a6/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>几个SAS编辑器里的快捷键</title>
		<link>http://www.jiangtanghu.com/cn/2008/01/26/%e5%87%a0%e4%b8%aasas%e7%bc%96%e8%be%91%e5%99%a8%e9%87%8c%e7%9a%84%e5%bf%ab%e6%8d%b7%e9%94%ae/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/01/26/%e5%87%a0%e4%b8%aasas%e7%bc%96%e8%be%91%e5%99%a8%e9%87%8c%e7%9a%84%e5%bf%ab%e6%8d%b7%e9%94%ae/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9966</guid>
		<description><![CDATA[快捷键这东西，一次不能学太多，每次记住一个，每个试上五遍就手熟了。先说几个有用的：

把代码注释掉，CTL+/
取消注释，CTL+SHIFT+/
大小写切换，CTL+SHIFT+L 、CTL+SHIFT+U
缩进，TAB
DO/END的匹配，ALT+[、ALT+]

***********下期预告，《SAS与Perl正则表达式》****************
]]></description>
			<content:encoded><![CDATA[<p>快捷键这东西，一次不能学太多，每次记住一个，每个试上五遍就手熟了。先说几个有用的：</p>
<ol>
<li>把代码注释掉，CTL+/</li>
<li>取消注释，CTL+SHIFT+/</li>
<li>大小写切换，CTL+SHIFT+L 、CTL+SHIFT+U</li>
<li>缩进，TAB</li>
<li>DO/END的匹配，ALT+[、ALT+]</li>
</ol>
<p>***********下期预告，《SAS与Perl正则表达式》****************</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/01/26/%e5%87%a0%e4%b8%aasas%e7%bc%96%e8%be%91%e5%99%a8%e9%87%8c%e7%9a%84%e5%bf%ab%e6%8d%b7%e9%94%ae/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAS和蒙特卡罗模拟（3）：SAS随机数函数及CALL子程序</title>
		<link>http://www.jiangtanghu.com/cn/2008/01/22/sas%e5%92%8c%e8%92%99%e7%89%b9%e5%8d%a1%e7%bd%97%e6%a8%a1%e6%8b%9f%ef%bc%883%ef%bc%89%ef%bc%9asas%e9%9a%8f%e6%9c%ba%e6%95%b0%e5%87%bd%e6%95%b0%e5%8f%8acall%e5%ad%90%e7%a8%8b%e5%ba%8f/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/01/22/sas%e5%92%8c%e8%92%99%e7%89%b9%e5%8d%a1%e7%bd%97%e6%a8%a1%e6%8b%9f%ef%bc%883%ef%bc%89%ef%bc%9asas%e9%9a%8f%e6%9c%ba%e6%95%b0%e5%87%bd%e6%95%b0%e5%8f%8acall%e5%ad%90%e7%a8%8b%e5%ba%8f/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9964</guid>
		<description><![CDATA[**************************************************************************************************************************
《SAS和蒙特卡罗模拟（1）：开篇》——简介，通过例子建立起蒙卡的直观概念；参考软件包及书目 
《SAS和蒙特卡罗模拟（2）：随机数基础》——随机数入门；参考书目

************************************************************************************************************************************************** 
一、SAS随机数函数和CALL子程序  
SAS系统产生随机数，两种方式，利用SAS函数(Functions)或者CALL子程序(CALL Routines)，它们的语法格式是（具体的区别容后讨论）：




          方式 
          代码 
                        说明 


函数 
 var=name(seed,&#60;arg&#62;) 
 var为存储随机数列的变量，name为特定的分布函数形式，seed为随机数种子，&#60;arg&#62;为特定分布要求的参数（可选） 


CALL子程序 
call name(seed,&#60;arg&#62;,var) 
 同上,记得seed=0, ±1,±2, , ± (2**31-2)




]]></description>
			<content:encoded><![CDATA[<h4>**************************************************************************************************************************</h4>
<blockquote><p>《<a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!362.entry" target="_blank">SAS和蒙特卡罗模拟（1）：开篇</a>》——简介，通过例子建立起蒙卡的直观概念；参考软件包及书目 </p>
<p>《<a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!369.entry" target="_blank">SAS和蒙特卡罗模拟（2）：随机数基础</a>》——随机数入门；参考书目</p>
</blockquote>
<p>************************************************************************************************************************************************** </p>
<p><strong>一、SAS随机数函数和CALL子程序</strong>  </p>
<p>SAS系统产生随机数，两种方式，利用SAS函数(Functions)或者CALL子程序(CALL Routines)，它们的语法格式是（具体的区别容后讨论）：<br />
<blockquote>
<table border="1" cellpadding="2" cellspacing="0" width="597">
<tbody>
<tr>
<td valign="top" width="130">          方式 </td>
<td valign="top" width="186">          代码 </td>
<td valign="top" width="279">                        说明 </td>
</tr>
<tr>
<td valign="top" width="131">函数 </td>
<td valign="top" width="188"> var=<em>name</em>(seed,&lt;arg&gt;) </td>
<td valign="top" width="277"> var为存储随机数列的变量，<em>name</em>为特定的分布函数形式，seed为随机数种子，&lt;arg&gt;为特定分布要求的参数（可选） </td>
</tr>
<tr>
<td valign="top" width="132">CALL子程序 </td>
<td valign="top" width="189">call <em>name</em>(seed,&lt;arg&gt;,var) </td>
<td valign="top" width="276"> 同上,记得seed=0, ±1,±2, , ± (2**31-2)</td>
</tr>
</tbody>
</table>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/01/22/sas%e5%92%8c%e8%92%99%e7%89%b9%e5%8d%a1%e7%bd%97%e6%a8%a1%e6%8b%9f%ef%bc%883%ef%bc%89%ef%bc%9asas%e9%9a%8f%e6%9c%ba%e6%95%b0%e5%87%bd%e6%95%b0%e5%8f%8acall%e5%ad%90%e7%a8%8b%e5%ba%8f/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>用SAS读入原始数据（1）：文本文件（续）</title>
		<link>http://www.jiangtanghu.com/cn/2008/01/21/%e7%94%a8sas%e8%af%bb%e5%85%a5%e5%8e%9f%e5%a7%8b%e6%95%b0%e6%8d%ae%ef%bc%881%ef%bc%89%ef%bc%9a%e6%96%87%e6%9c%ac%e6%96%87%e4%bb%b6%ef%bc%88%e7%bb%ad%ef%bc%89/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/01/21/%e7%94%a8sas%e8%af%bb%e5%85%a5%e5%8e%9f%e5%a7%8b%e6%95%b0%e6%8d%ae%ef%bc%881%ef%bc%89%ef%bc%9a%e6%96%87%e6%9c%ac%e6%96%87%e4%bb%b6%ef%bc%88%e7%bb%ad%ef%bc%89/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9963</guid>
		<description><![CDATA[***************************************************** 
用SAS读入原始数据（1）：文本文件 
**************************************************** 
总结一下，有两种文本文件，及其对应的读入方法：

字段固定(Fixed Filed)——列输入模式(Column)、格式化输入模式(Formatted)  
分隔符固定(Delimited Data)——列举输入模式(List)

对字段固定的文本文件，列输入模式：

对数值变量，只能读入标准数据，包括正负号、小数点、数字、和由E构成的科学计数；  
不能够读入日期时间，以及包含美元符号、逗号等字符的数值；  
对字段的选择非常灵活，可以任意选择字段和读入的次序。

格式化输入模式：

由指针控制读入的列数；  
可以设定输入格式。

对分隔符固定的文本文件，列举输入模式： 
对分隔符固定的文本文件，系统根据分隔符就能区分各个变量，对系统默认的以空格为分隔符的数据文件，列举输入模式的input语句最为简单：

input 变量名&#60;s&#62;;

以下是一些扩展：

如果源文件不是以空格为分隔符，比如是用逗号做分隔符，那么需要在infile语句后面加上 dlm=&#34;,&#34;     ；  
如果要读入超过8个字节的字符型变量，可以在数据步中加上一个length语句；  
如果要使用输入格式，可以采用带修饰的列举模式，它的input语句类似input a $:12.; 
在源数据文件中，比如是以逗号为分隔符，但文件中逗号还可能作为其中字符串的分隔符，这样就需要在infile语句中加上 dsd    ；

最后，在实际工作中，可能需要混合使用以上几种输入模式，见汪嘉冈（2001，P.111）。 
参考资料：

汪嘉冈《SAS V8基础教程》，北京：中国统计出版社，2001  
SAS OnlineTutor: Basic and Intermediate SAS

Technorati Tags: SAS

]]></description>
			<content:encoded><![CDATA[<p>***************************************************** </p>
<p><a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!376.entry" target="_blank">用SAS读入原始数据（1）：文本文件</a> </p>
<p>**************************************************** </p>
<p>总结一下，有两种文本文件，及其对应的读入方法：
<ol>
<li>字段固定(Fixed Filed)——列输入模式(Column)、格式化输入模式(Formatted)  </li>
<li>分隔符固定(Delimited Data)——列举输入模式(List)</li>
</ol>
<p>对<strong>字段固定</strong>的文本文件，<strong>列输入模式</strong>：
<ol>
<li>对数值变量，只能读入标准数据，包括正负号、小数点、数字、和由E构成的科学计数；  </li>
<li>不能够读入日期时间，以及包含美元符号、逗号等字符的数值；  </li>
<li>对字段的选择非常灵活，可以任意选择字段和读入的次序。</li>
</ol>
<p><strong>格式化输入模式</strong>：
<ol>
<li>由指针控制读入的列数；  </li>
<li>可以设定输入格式。</li>
</ol>
<p>对<strong>分隔符固定</strong>的文本文件，<strong>列举输入模式</strong>： </p>
<p>对分隔符固定的文本文件，系统根据分隔符就能区分各个变量，对系统默认的以<strong>空格</strong>为分隔符的数据文件，列举输入模式的input语句最为简单：<br />
<blockquote>
<p>input 变量名&lt;s&gt;;</p>
</blockquote>
<p>以下是一些扩展：
<ol>
<li>如果源文件不是以空格为分隔符，比如是用逗号做分隔符，那么需要在infile语句后面加上 <em>dlm=&quot;,&quot;</em>     ；  </li>
<li>如果要读入超过8个字节的字符型变量，可以在数据步中加上一个length语句；  </li>
<li>如果要使用输入格式，可以采用带修饰的列举模式，它的input语句类似<em>input a $<font color="#ff0000">:</font>12.;</em> </li>
<li>在源数据文件中，比如是以逗号为分隔符，但文件中逗号还可能作为其中字符串的分隔符，这样就需要在infile语句中加上 <em>dsd</em>    ；</li>
</ol>
<p>最后，<strong>在实际工作中，可能需要混合使用以上几种输入模式，</strong>见汪嘉冈（2001，P.111）。 </p>
<p>参考资料：
<ol>
<li>汪嘉冈《SAS V8基础教程》，北京：中国统计出版社，2001  </li>
<li>SAS OnlineTutor: Basic and Intermediate SAS</li>
</ol>
<div style="margin:0px;padding:0px;display:inline">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a></div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/01/21/%e7%94%a8sas%e8%af%bb%e5%85%a5%e5%8e%9f%e5%a7%8b%e6%95%b0%e6%8d%ae%ef%bc%881%ef%bc%89%ef%bc%9a%e6%96%87%e6%9c%ac%e6%96%87%e4%bb%b6%ef%bc%88%e7%bb%ad%ef%bc%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用SAS读入原始数据（1）：文本文件</title>
		<link>http://www.jiangtanghu.com/cn/2008/01/20/%e7%94%a8sas%e8%af%bb%e5%85%a5%e5%8e%9f%e5%a7%8b%e6%95%b0%e6%8d%ae%ef%bc%881%ef%bc%89%ef%bc%9a%e6%96%87%e6%9c%ac%e6%96%87%e4%bb%b6/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/01/20/%e7%94%a8sas%e8%af%bb%e5%85%a5%e5%8e%9f%e5%a7%8b%e6%95%b0%e6%8d%ae%ef%bc%881%ef%bc%89%ef%bc%9a%e6%96%87%e6%9c%ac%e6%96%87%e4%bb%b6/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9961</guid>
		<description><![CDATA[文本文件多以.txt、.dat以及.csv为后缀（在Unix/Linux世界，还可能出现.data数据甚至没有后缀的情况）。一般分两种，其一看起来跟下面一样——如果用UltraEdit等编辑器打开，你能看到指示列数的标尺，而且每个字段的列数是固定的，称为字段固定(Fixed Fields)的文本文件：

2810 61 MOD  F2804 38 HIGH F 

下面的数据中，每个字段的列数不必相同，但都由同一样个的分隔符（这里是逗号）分开，所以称为分隔符固定(Delimited Data)或者自由格式(Free-format)的文件文件。如果分隔符为逗号（通常以.csv为后缀），干脆就叫做“用逗号分隔的文本文件”：

1-Mar-90,LON,19813-Mar-90,FRA,2073

对以上两种文本格式的数据，SAS提供了以下四种基本的输入模式：

列输入模式(Column) ——应用于字段固定的文本文件 
格式化输入模式(Formatted) ——应用于字段固定的文本文件 
列举输入模式(List) ——应用于分隔符固定的文本文件 
命名输入模式(Named)

对以上几种输入模式，基本的语句如下，区别就在于input语句的具体设定：

data 你对导入数据的命名;    infile  源文件名,加上具体的盘符位置;    input 变量输入设定；run;

1.列输入模式(Column)&#8211;应用于字段固定的文本文件 
对字段固定的源文件，input语句的形式是

input 变量名1&#60;s&#62;开始列数-结束列数 变量名2&#60;s&#62;开始列数-结束列数 …;

一个能工作的列输入模式语句看起来就像下面展示的：

data work.example1;    infile &#8216;C:\data\example1.dat&#8217;  firstobs=2 obs=100;    input ID 1-3 Name $ 5-10;run;

优点：

对字段的选择非常灵活，可以任意选择字段，以及安排读入的次序；  
整个字段或其部分可以重复读入；  
字段间不一定要有空格或者其他分隔符来分隔；  
字符变量最多可含32K个字符，并可以包含空格符；  
对缺失数据没有特殊占位符的要求。一个空格字段就读为一个缺失值，也不会引起其他字段读入的错误。

局限：

可以设定输入长度，但不可以设定输入格式。对数值型变量，只能读入标准数据值(Standard Numeric Data Value)，即只包括数字、正负号、小数点和科学计数符号E构成的数，对日期型数据，以及包含美元符号、逗号等其他符号的数值，因为需要设定输入格式并按格式读入，列输入模式就无法正确读取。

2.格式化输入模式(Formatted)&#8211;应用于字段固定的文本文件 
格式化输入模式类似于列模式：

它适用于字段固定格式的数据文件；  
它也给出字段开始的列数，但不直接给出结束列数，而是通过输入格式给出读入长度；  
它可以设定输入格式。

它的input语句的格式为：

input &#60;指针控制&#62; 变量名 输入格式 [...]]]></description>
			<content:encoded><![CDATA[<p>文本文件多以.txt、.dat以及.csv为后缀（在Unix/Linux世界，还可能出现.data数据甚至没有后缀的情况）。一般分两种，其一看起来跟下面一样——<strong>如果用UltraEdit等编辑器打开，你能看到指示列数的标尺</strong>，而且每个字段的列数是固定的，称为<strong>字段固定(Fixed Fields)</strong>的文本文件：<br />
<blockquote>
<p>2810 61 MOD  F<br />2804 38 HIGH F </p>
</blockquote>
<p>下面的数据中，每个字段的列数不必相同，但都由同一样个的分隔符（这里是逗号）分开，所以称为<strong>分隔符固定(Delimited Data</strong>)或者自由格式(Free-format)的文件文件。如果分隔符为逗号（通常以.csv为后缀），干脆就叫做“用逗号分隔的文本文件”：<br />
<blockquote>
<p>1-Mar-90,LON,198<br />13-Mar-90,FRA,2073</p>
</blockquote>
<p>对以上两种文本格式的数据，SAS提供了以下四种基本的输入模式：
<ol>
<li>列输入模式(Column) ——应用于字段固定的文本文件 </li>
<li>格式化输入模式(Formatted) ——应用于字段固定的文本文件 </li>
<li>列举输入模式(List) ——应用于分隔符固定的文本文件 </li>
<li>命名输入模式(Named)</li>
</ol>
<p>对以上几种输入模式，基本的语句如下，区别就在于input语句的具体设定：<br />
<blockquote>
<p>data 你对导入数据的命名;<br />    infile  源文件名,加上具体的盘符位置;<br />    input 变量输入设定；<br />run;</p>
</blockquote>
<p><strong>1.列输入模式(Column)</strong>&#8211;应用于字段固定的文本文件 </p>
<p>对字段固定的源文件，input语句的形式是<br />
<blockquote>
<p>input 变量名1&lt;s&gt;开始列数-结束列数 变量名2&lt;s&gt;开始列数-结束列数 …;</p>
</blockquote>
<p>一个能工作的列输入模式语句看起来就像下面展示的：<br />
<blockquote>
<p>data work.example1;<br />    infile &#8216;C:\data\example1.dat&#8217;  firstobs=2 obs=100;<br />    input ID 1-3 Name $ 5-10;<br />run;</p>
</blockquote>
<p>优点：
<ol>
<li>对字段的选择非常灵活，可以任意选择字段，以及安排读入的次序；  </li>
<li>整个字段或其部分可以重复读入；  </li>
<li>字段间不一定要有空格或者其他分隔符来分隔；  </li>
<li>字符变量最多可含32K个字符，并可以包含空格符；  </li>
<li>对缺失数据没有特殊占位符的要求。一个空格字段就读为一个缺失值，也不会引起其他字段读入的错误。</li>
</ol>
<p>局限：
<ol>
<li>可以设定输入长度，但不可以设定输入格式。对数值型变量，只能读入标准数据值(Standard Numeric Data Value)，即只包括数字、正负号、小数点和科学计数符号E构成的数，对日期型数据，以及包含美元符号、逗号等其他符号的数值，因为需要设定输入格式并按格式读入，列输入模式就无法正确读取。</li>
</ol>
<p><strong>2.格式化输入模式(Formatted)</strong>&#8211;应用于字段固定的文本文件 </p>
<p>格式化输入模式类似于列模式：
<ol>
<li>它适用于字段固定格式的数据文件；  </li>
<li>它也给出字段开始的列数，但不直接给出结束列数，而是通过输入格式给出读入长度；  </li>
<li>它可以设定输入格式。</li>
</ol>
<p>它的input语句的格式为：<br />
<blockquote>
<p>input &lt;指针控制&gt; 变量名 输入格式 …;</p>
</blockquote>
<p>注1：指针控制，就是将输入列指针控制在某个位置，作为读入字段的开始列号，它有 @n 或者 +n 的形式：
<ul>
<li>@n表示从第n列开始读入（指示开始列数的绝对位置）；  </li>
<li>+n表示将列控制指针增加n列侯读入（指示相对位置）。</li>
</ul>
<p>一个能工作的格式化输入模式语句看起来就像下面展示的：<br />
<blockquote>
<p>data work.example2;<br />    infile &#8216;C:\data\example2.dat&#8217;;<br />    input Name $ 2. @3 Job $5. +7 Place $8.;<br />run;</p>
</blockquote>
<p><strong>3.列举输入模式(List)</strong>&#8211;应用于分隔符固定的文本文件 </p>
<p>因为分隔符固定的数据可以用分隔符来确定字段，input语句特别简单：<br />
<blockquote>
<p>input 变量名&lt;s&gt;…;</p>
</blockquote>
<p>如果要读入非空格分隔符的数据，就需要在infile语句中指明（默认为空格）：<br />
<blockquote>
<p>infile 文件盘符 &lt;dlm=&quot;分隔符&quot;&gt;;</p>
</blockquote>
<p>在列举模式下，变量长度的缺省值为8，长度超过8的字符变量在读入时会被截断，这时可以用lenght语句来设定长度：<br />
<blockquote>
<p>length 变量名&lt;s&gt; 长度;</p>
</blockquote>
<p>列举模式也可以设定输入格式，这只需要在输入变量设定时附加上相关修饰：<br />
<blockquote>
<p>input 变量名&lt;s&gt;: 输入格式 …;</p>
</blockquote>
<p>一个能工作的列举输入模式语句看起来就像下面展示的：<br />
<blockquote>
<p>data work.example3;<br />    infile &#8216;C:\data\example3.dat&#8217; dlm=&#8217;,';<br />    length item $ 10.;<br />    input ID Name $ item $   income:comma9.;<br />run;</p>
</blockquote>
<p><strong>4.命名输入模式(Named)</strong> </p>
<p>命名输入模式很少见到，因为很难得见到这种格式的原数据，其中三个变量是ID、Name和Score：<br />
<blockquote>
<p>1 Name=Tom Score=A<br />2 Name=Jim  Score=C</p>
</blockquote>
<p>相应的input语句为:<br />
<blockquote>
<p>input  ID Name=$3. Score=$1.</p>
</blockquote>
<p>参考资料：
<ol>
<li>汪嘉冈《SAS V8基础教程》，北京：中国统计出版社，2001 </li>
<li>SAS OnlineTutor: Basic and Intermediate SAS</li>
</ol>
<div style="margin:0px;padding:0px;display:inline">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a></div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/01/20/%e7%94%a8sas%e8%af%bb%e5%85%a5%e5%8e%9f%e5%a7%8b%e6%95%b0%e6%8d%ae%ef%bc%881%ef%bc%89%ef%bc%9a%e6%96%87%e6%9c%ac%e6%96%87%e4%bb%b6/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SAS和蒙特卡罗模拟（2）：随机数基础</title>
		<link>http://www.jiangtanghu.com/cn/2008/01/12/sas%e5%92%8c%e8%92%99%e7%89%b9%e5%8d%a1%e7%bd%97%e6%a8%a1%e6%8b%9f%ef%bc%882%ef%bc%89%ef%bc%9a%e9%9a%8f%e6%9c%ba%e6%95%b0%e5%9f%ba%e7%a1%80/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/01/12/sas%e5%92%8c%e8%92%99%e7%89%b9%e5%8d%a1%e7%bd%97%e6%a8%a1%e6%8b%9f%ef%bc%882%ef%bc%89%ef%bc%9a%e9%9a%8f%e6%9c%ba%e6%95%b0%e5%9f%ba%e7%a1%80/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9958</guid>
		<description><![CDATA[**************************************************************************************************************************
《SAS和蒙特卡罗模拟（1）：开篇》——简介，通过例子建立起蒙卡的直观概念；参考软件包及书目

**************************************************************************************************************************************************
SAS for Monte Carlo Simulations (2): Random Numbers

最简单、最基本、最重要的随机变量是在[0,1]上均匀分布的随机变量。一般地，我们把[0,1]上均匀分布随机变量的抽样值称为随机数，其他分布随机变量的抽样都是借助于随机数来实现的。以下谈的都是所谓“伪随机数”(Pseudo Random Numbers)。产生随机数，可以通过物理方法取得（很久很久以前，兰德公司就曾以随机脉冲源做信息源，利用电子旋转轮来产生随机数表），但当今最为普遍的乃是在计算机上利用数学方法产生随机数。这种随机数根据特定的迭代公式计算出来，初值确定后，序列就可以预测出来，所以不能算是真正的随机数（就成为“伪随机数”）。不过，在应用中，只要产生的伪随机数列能通过一系列统计检验，就可以把它们当成“真”随机数来用。 
现在大多软件包内置的随机数产生程序，都是使用同余法(Congruential Random Numbers Generators)。“同余”是数论中的概念。

0.预备知识：同余

捡回小学一年级的东西：&#34;4/2=2&#34;读作“4除以2等于2”，或者，“2除4等于2”。还有求模的符号mod(number,divisor)，其中，number是被除数（在上式中，为4），divisor是除数（上式中的2）。这样的约定对SAS和Excel都通用，如mod(4,13)=4，mod(13,4)=1。 
现在我们可以开讲“同余”了。设m是正整数，用m去除整数a、b，得到的余数相同，则称“a与b关于模m同余”。上面的定义可以读写成，对整数a、b和正整数m，若mod(a,m)=mod(b,m)，则称“a与b关于模m有相同的余数（同余）”，记做a≡b(mod m)（这就是同余式）。举个例子，mod(13,4)=1，mod(1,4)=1，则读成13和1关于模4同余，记做13≡1(mod 4)。当然，同余具有对称性，上式还可以写成1=13(mod 4)。 
a≡b(mod m)的一个充要条件是a=b+mt，t是整数，比如13=1+3*4。a=b+mt可以写成(a-b)/m=t，即m能整除(a-b)。 
这些就够了。更多基础性的介绍，可以参考《同余（数据基础）》。

1.乘同余法

同余法是一大类方法的统称，包括加同余法、乘同余法等。因为这些方法中的迭代公式都可以写成上面我们见过的同余式形式，故统称同余法。常用的就是下面的乘同余法(Multiplicative Congruential Generator.)。符号不好敲，做些约定，如R(i)就是R加一个下标i。 
乘同余法随机数生成器的同余形式如下：R(i+1)=a*R(i) (mod m)。这个迭代式可以写成更直观的形式，R(i+1)=mod[a*R(i),m]，其中初值R(0)称为随机数种子。因为mod(x,m)总是等于0到m-1的一个整数，所以最后把R(i+1)这个随机序列都除以m，就可以得到在[0,1]上均匀分布的随机数。下面用电子表格演示一遍，假设随机数种子R(0)=1，a=4，m=13：



  
A 
B 
C 
D 
E 


1 
i 
R(i) 
a*R(i) 
mod[a*R(i),m] 
mod[a*R(i),m]/m 


2 
0 
1 
=B2*4 
=mod(C2,13) 
=D2/13 


3 
1 
=D2 
=B3*4 
=mod(C3,13) 
=D3/13 


4 
2 
=D3 
=B4*4 
=mod(C4,13) 
=D4/13



]]></description>
			<content:encoded><![CDATA[<h4>**************************************************************************************************************************</h4>
<blockquote><p>《<a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!362.entry" target="_blank">SAS和蒙特卡罗模拟（1）：开篇</a>》——简介，通过例子建立起蒙卡的直观概念；参考软件包及书目</p>
</blockquote>
<p>**************************************************************************************************************************************************<br />
<h4>SAS for Monte Carlo Simulations (2): Random Numbers</h4>
</p>
<p>最简单、最基本、最重要的随机变量是在[0,1]上均匀分布的随机变量。一般地，我们把[0,1]上均匀分布随机变量的抽样值称为随机数，其他分布随机变量的抽样都是借助于随机数来实现的。以下谈的都是所谓“伪随机数”(Pseudo Random Numbers)。产生随机数，可以通过物理方法取得（很久很久以前，兰德公司就曾以随机脉冲源做信息源，利用电子旋转轮来产生随机数表），但当今最为普遍的乃是在计算机上利用数学方法产生随机数。这种随机数根据特定的迭代公式计算出来，初值确定后，序列就可以预测出来，所以不能算是真正的随机数（就成为“伪随机数”）。不过，在应用中，只要产生的伪随机数列能通过一系列统计检验，就可以把它们当成“真”随机数来用。 </p>
<p>现在大多软件包内置的随机数产生程序，都是使用同余法(Congruential Random Numbers Generators)。“同余”是数论中的概念。<br />
<blockquote>
<p>0.预备知识：同余</p>
</blockquote>
<p>捡回小学一年级的东西：&quot;4/2=2&quot;读作“4<strong>除以</strong>2等于2”，或者，“2<strong>除</strong>4等于2”。还有求模的符号mod(number,divisor)，其中，number是被除数（在上式中，为4），divisor是除数（上式中的2）。这样的约定对SAS和Excel都通用，如mod(4,13)=4，mod(13,4)=1。 </p>
<p>现在我们可以开讲“同余”了。设m是正整数，用m去<strong>除</strong>整数a、b，得到的余数相同，则称“a与b关于模m同余”。上面的定义可以读写成，对整数a、b和正整数m，若mod(a,m)=mod(b,m)，则称“a与b关于模m有相同的余数（同余）”，记做a≡b(mod m)（这就是同余式）。举个例子，mod(13,4)=1，mod(1,4)=1，则读成13和1关于模4同余，记做13≡1(mod 4)。当然，同余具有对称性，上式还可以写成1=13(mod 4)。 </p>
<p>a≡b(mod m)的一个充要条件是a=b+mt，t是整数，比如13=1+3*4。a=b+mt可以写成(a-b)/m=t，即m能整除(a-b)。 </p>
<p>这些就够了。更多基础性的介绍，可以参考《<a href="http://blog.csdn.net/oopos/archive/2007/10/15/1826103.aspx" target="_blank">同余（数据基础）</a>》。<br />
<blockquote>
<p>1.乘同余法</p>
</blockquote>
<p>同余法是一大类方法的统称，包括加同余法、乘同余法等。因为这些方法中的迭代公式都可以写成上面我们见过的同余式形式，故统称同余法。常用的就是下面的乘同余法(Multiplicative Congruential Generator.)。符号不好敲，做些约定，如R(i)就是R加一个下标i。 </p>
<p>乘同余法随机数生成器的同余形式如下：R(i+1)=a*R(i) (mod m)。这个迭代式可以写成更直观的形式，R(i+1)=mod[a*R(i),m]，其中初值R(0)称为随机数种子。因为mod(x,m)总是等于0到m-1的一个整数，所以最后把R(i+1)这个随机序列都除以m，就可以得到在[0,1]上均匀分布的随机数。下面用电子表格演示一遍，假设随机数种子R(0)=1，a=4，m=13：<br />
<table border="1" cellpadding="2" cellspacing="0" width="491">
<tbody>
<tr>
<td valign="top" width="59">  </td>
<td valign="top" width="65">A </td>
<td valign="top" width="67">B </td>
<td valign="top" width="71">C </td>
<td valign="top" width="97">D </td>
<td valign="top" width="130">E </td>
</tr>
<tr>
<td valign="top" width="59">1 </td>
<td valign="top" width="64">i </td>
<td valign="top" width="68">R(i) </td>
<td valign="top" width="72">a*R(i) </td>
<td valign="top" width="97">mod[a*R(i),m] </td>
<td valign="top" width="130">mod[a*R(i),m]/m </td>
</tr>
<tr>
<td valign="top" width="59">2 </td>
<td valign="top" width="64">0 </td>
<td valign="top" width="68"><font color="#ff0000">1</font> </td>
<td valign="top" width="73">=B2*4 </td>
<td valign="top" width="97">=mod(C2,13) </td>
<td valign="top" width="130">=D2/13 </td>
</tr>
<tr>
<td valign="top" width="58">3 </td>
<td valign="top" width="64">1 </td>
<td valign="top" width="68">=D2 </td>
<td valign="top" width="74">=B3*4 </td>
<td valign="top" width="97">=mod(C3,13) </td>
<td valign="top" width="129">=D3/13 </td>
</tr>
<tr>
<td valign="top" width="58">4 </td>
<td valign="top" width="64">2 </td>
<td valign="top" width="68">=D3 </td>
<td valign="top" width="75">=B4*4 </td>
<td valign="top" width="97">=mod(C4,13) </td>
<td valign="top" width="129">=D4/13</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/01/12/sas%e5%92%8c%e8%92%99%e7%89%b9%e5%8d%a1%e7%bd%97%e6%a8%a1%e6%8b%9f%ef%bc%882%ef%bc%89%ef%bc%9a%e9%9a%8f%e6%9c%ba%e6%95%b0%e5%9f%ba%e7%a1%80/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SAS Tips &amp;Tricks：按组求累加值</title>
		<link>http://www.jiangtanghu.com/cn/2008/01/12/sas-tips-tricks%ef%bc%9a%e6%8c%89%e7%bb%84%e6%b1%82%e7%b4%af%e5%8a%a0%e5%80%bc/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/01/12/sas-tips-tricks%ef%bc%9a%e6%8c%89%e7%bb%84%e6%b1%82%e7%b4%af%e5%8a%a0%e5%80%bc/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9957</guid>
		<description><![CDATA[按组求累加值：原数据由下面给出：

data a;    input id sum;cards;1 41 32 52 72 93 63 6;

上面id分为1、2、3，要求按每组求累加值，即生成一个新变量cum，它看起来是这样的：

id    sum    cum1     4       41     3       72     5       52     7      122     9      213     6       63     6      12 

方案一：

proc sort data=a;    by id;run; 
data b;    set a;    by id; 
retain cum;if first.id then cum=sum ;        else cum=cum+sum;run;

方案二（方案一的小改进）：

proc sort data=a;    by id;run; 
data b;    set a;    [...]]]></description>
			<content:encoded><![CDATA[<p>按组求累加值：原数据由下面给出：<br />
<blockquote>
<p>data a;<br />    input id sum;<br />cards;<br />1 4<br />1 3<br />2 5<br />2 7<br />2 9<br />3 6<br />3 6<br />;</p>
</blockquote>
<p>上面id分为1、2、3，要求按每组求累加值，即生成一个新变量cum，它看起来是这样的：<br />
<blockquote>
<p>id    sum    cum<br />1     4       4<br />1     3       7<br />2     5       5<br />2     7      12<br />2     9      21<br />3     6       6<br />3     6      12 </p>
</blockquote>
<p>方案一：<br />
<blockquote>
<p>proc sort data=a;<br />    by id;<br />run; </p>
<p>data b;<br />    set a;<br />    by id; </p>
<p><font color="#ff0000">retain</font> cum;<br />if first.id then cum=sum ;<br />        else cum=cum+sum;<br />run;</p>
</blockquote>
<p>方案二（方案一的小改进）：<br />
<blockquote>
<p>proc sort data=a;<br />    by id;<br />run; </p>
<p>data b;<br />    set a;<br />    by id;<br />    if first.id then cum=sum ;<br />        else <font color="#ff0000">cum+sum</font>;<br />run;</p>
</blockquote>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/01/12/sas-tips-tricks%ef%bc%9a%e6%8c%89%e7%bb%84%e6%b1%82%e7%b4%af%e5%8a%a0%e5%80%bc/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>SAS和蒙特卡罗模拟（1）：开篇</title>
		<link>http://www.jiangtanghu.com/cn/2008/01/09/sas%e5%92%8c%e8%92%99%e7%89%b9%e5%8d%a1%e7%bd%97%e6%a8%a1%e6%8b%9f%ef%bc%881%ef%bc%89%ef%bc%9a%e5%bc%80%e7%af%87/</link>
		<comments>http://www.jiangtanghu.com/cn/2008/01/09/sas%e5%92%8c%e8%92%99%e7%89%b9%e5%8d%a1%e7%bd%97%e6%a8%a1%e6%8b%9f%ef%bc%881%ef%bc%89%ef%bc%9a%e5%bc%80%e7%af%87/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9956</guid>
		<description><![CDATA[SAS for Monte Carlo Simulations (1): Introduction

一、为什么选择SAS做蒙特卡罗模拟？ 
为什么要用SAS做蒙卡？首先，对我来说，我只会用SAS，而且打算用SAS完成我所有的工作。当然，其他一些通用的理由有(Fan, etc.,2002)：

蒙卡是个计算密集的活，而SAS Base、SAS Macro、SAS/IML强大而灵活的编程能力能满足这一要求；  
做蒙卡时要用到大量的统计/数学技术，而SAS就内置了大量的统计/数学函数(在 SAS/Stat和SAS/ETS)；用Fortran或C++当然也是非常好的主意，只是他们缺少内置的统计函数，代码就要冗长复杂很多。

二、什么是蒙卡？一个启发性例子 
好，开始，什么是蒙卡？了解它背景知识的最好办法当然是wiki-Monte_Carlo_method。蒙特卡罗是位于摩洛哥的一家赌场，二战时，美国Los Alamos国家实验室把它作为核裂变计算机模拟的代码名称。作为模拟方法，蒙卡以前就叫统计抽样(statistical sampling)，我们感兴趣的结果因为输入变量的不确定而不可知，但如果能依概率产生输入变量的样本，我们就可以估计到结果变量的分布。跟蒙卡对应的，还有一种模拟技术叫系统模拟，包括排队、库存等模型，这些模型都跟随时间推移而出现的事件序列有关。下面举个蒙卡的例子，来自Evans, etc.( 2001)的超级简化版。 
假设一家企业，利润是其需求量的函数，需求是随机变量。为了简化讨论，假定利润就是需求的两倍。这里输入变量就是不可控的需求，结果变量就是我们感兴趣的利润。假设需求以相同的概率取10、20、30、40、50、60这六种情况。在这样的简化下，我们就可以投一枚均匀的骰子来产生需求的样本，如果点数为1，对应得需求就是10，点数为2，需求就是20，以下类推。这样，我们的模拟过程就是：

投骰子；  
根据骰子的点数确定需求量；  
根据需求量，求利润。

掷10次骰子，假设我们的模拟结果如下：



重复次数 
骰子点数 
需求量 
利润 


1 
5 
50 
100 


2 
3 
30 
60 


3 
3 
30 
60 


4 
6 
60 
120 


5 
1 
10 
20 


6 
3 
30 
60 


7 
4 
40 
40 [...]]]></description>
			<content:encoded><![CDATA[<blockquote><h4>SAS for Monte Carlo Simulations (1): Introduction</h4>
</blockquote>
<p>一、为什么选择SAS做蒙特卡罗模拟？ </p>
<p>为什么要用SAS做蒙卡？首先，对我来说，我只会用SAS，而且打算用SAS完成我所有的工作。当然，其他一些通用的理由有(Fan, etc.,2002)：
<ol>
<li>蒙卡是个计算密集的活，而SAS Base、SAS Macro、SAS/IML强大而灵活的编程能力能满足这一要求；  </li>
<li>做蒙卡时要用到大量的统计/数学技术，而SAS就内置了大量的统计/数学函数(在 SAS/Stat和SAS/ETS)；用Fortran或C++当然也是非常好的主意，只是他们缺少内置的统计函数，代码就要冗长复杂很多。</li>
</ol>
<p>二、什么是蒙卡？一个启发性例子 </p>
<p>好，开始，什么是蒙卡？了解它背景知识的最好办法当然是<a title="http://en.wikipedia.org/wiki/Monte_Carlo_method" href="http://en.wikipedia.org/wiki/Monte_Carlo_method" target="_blank">wiki-Monte_Carlo_method</a>。蒙特卡罗是位于摩洛哥的一家赌场，二战时，美国Los Alamos国家实验室把它作为核裂变计算机模拟的代码名称。作为模拟方法，蒙卡以前就叫统计抽样(statistical sampling)，我们感兴趣的结果因为输入变量的不确定而不可知，但如果能依概率产生输入变量的样本，我们就可以估计到结果变量的分布。跟蒙卡对应的，还有一种模拟技术叫系统模拟，包括排队、库存等模型，这些模型都跟随时间推移而出现的事件序列有关。下面举个蒙卡的例子，来自Evans, etc.( 2001)的超级简化版。 </p>
<p>假设一家企业，利润是其需求量的函数，需求是随机变量。为了简化讨论，假定利润就是需求的两倍。这里输入变量就是不可控的需求，结果变量就是我们感兴趣的利润。假设需求以相同的概率取10、20、30、40、50、60这六种情况。在这样的简化下，我们就可以投一枚<strong>均匀的</strong>骰子来产生需求的样本，如果点数为1，对应得需求就是10，点数为2，需求就是20，以下类推。这样，我们的模拟过程就是：
<ol>
<li>投骰子；  </li>
<li>根据骰子的点数确定需求量；  </li>
<li>根据需求量，求利润。</li>
</ol>
<p>掷10次骰子，假设我们的模拟结果如下：<br />
<table border="0" cellpadding="2" cellspacing="0" width="400">
<tbody>
<tr>
<td valign="top" width="100">重复次数 </td>
<td valign="top" width="100">骰子点数 </td>
<td valign="top" width="100">需求量 </td>
<td valign="top" width="100">利润 </td>
</tr>
<tr>
<td valign="top" width="100">1 </td>
<td valign="top" width="100">5 </td>
<td valign="top" width="100">50 </td>
<td valign="top" width="100">100 </td>
</tr>
<tr>
<td valign="top" width="100">2 </td>
<td valign="top" width="100">3 </td>
<td valign="top" width="100">30 </td>
<td valign="top" width="100">60 </td>
</tr>
<tr>
<td valign="top" width="100">3 </td>
<td valign="top" width="100">3 </td>
<td valign="top" width="100">30 </td>
<td valign="top" width="100">60 </td>
</tr>
<tr>
<td valign="top" width="100">4 </td>
<td valign="top" width="100">6 </td>
<td valign="top" width="100">60 </td>
<td valign="top" width="100">120 </td>
</tr>
<tr>
<td valign="top" width="100">5 </td>
<td valign="top" width="100">1 </td>
<td valign="top" width="100">10 </td>
<td valign="top" width="100">20 </td>
</tr>
<tr>
<td valign="top" width="100">6 </td>
<td valign="top" width="100">3 </td>
<td valign="top" width="100">30 </td>
<td valign="top" width="100">60 </td>
</tr>
<tr>
<td valign="top" width="100">7 </td>
<td valign="top" width="100">4 </td>
<td valign="top" width="100">40 </td>
<td valign="top" width="100">40 </td>
</tr>
<tr>
<td valign="top" width="100">8 </td>
<td valign="top" width="100">5 </td>
<td valign="top" width="100">50 </td>
<td valign="top" width="100">100 </td>
</tr>
<tr>
<td valign="top" width="100">9 </td>
<td valign="top" width="100">2 </td>
<td valign="top" width="100">20 </td>
<td valign="top" width="100">20 </td>
</tr>
<tr>
<td valign="top" width="100">10 </td>
<td valign="top" width="100">5 </td>
<td valign="top" width="100">50 </td>
<td valign="top" width="100">50</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2008/01/09/sas%e5%92%8c%e8%92%99%e7%89%b9%e5%8d%a1%e7%bd%97%e6%a8%a1%e6%8b%9f%ef%bc%881%ef%bc%89%ef%bc%9a%e5%bc%80%e7%af%87/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>SAS程序员必备的十大技巧</title>
		<link>http://www.jiangtanghu.com/cn/2007/12/29/sas%e7%a8%8b%e5%ba%8f%e5%91%98%e5%bf%85%e5%a4%87%e7%9a%84%e5%8d%81%e5%a4%a7%e6%8a%80%e5%b7%a7/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/12/29/sas%e7%a8%8b%e5%ba%8f%e5%91%98%e5%bf%85%e5%a4%87%e7%9a%84%e5%8d%81%e5%a4%a7%e6%8a%80%e5%b7%a7/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9955</guid>
		<description><![CDATA[SUGI27(2002)有一篇被广泛引用的文章，就两页纸，Doug Zirbel的10 Things Experienced SAS® Programmers Don’t Know – But Should(“SAS程序员不知道但必须知道的10件事”)，题目挺拉风，讲的是对有经验的SAS程序员的一次非正式调查，要他们列出SAS程序员需要的一些技巧。其实一共列出了22条，当然前10条是最重要的：

Macros—basic knowledge of macro language——对SAS宏语言的基本了解。这里作者推荐的主打文档当然是SAS Manuals中的SAS Macro language，以及SAS Guide to Macro Processing，然后还有Little SAS Book和Carpenter&#8217;s Complete Guide to the SAS Macro Language  
Data Step—basic knowledge of data step——对SAS数据步的基本了解，参见一篇SUGI21的文章，Thomas Miron的The Secret Lift of the Data Step 
Data file manipulation—INFILE, UPDATE, SET intricacies etc ——数据文件操作语句，如infile、update、set等 
ODS——SAS输出传送系统(Output Delivery [...]]]></description>
			<content:encoded><![CDATA[<p>SUGI27(2002)有一篇被广泛引用的文章，就两页纸，Doug Zirbel的<a href="http://www2.sas.com/proceedings/sugi27/p240-27.pdf" target="_blank">10 Things Experienced SAS® Programmers Don’t Know – But Should</a>(“SAS程序员不知道但必须知道的10件事”)，题目挺拉风，讲的是对有经验的SAS程序员的一次非正式调查，要他们列出SAS程序员需要的一些技巧。其实一共列出了22条，当然前10条是最重要的：
<ol>
<li>Macros—basic knowledge of macro language——对SAS宏语言的基本了解。这里作者推荐的主打文档当然是SAS Manuals中的<em>SAS Macro language，</em>以及SAS Guide to Macro Processing，然后还有Little SAS Book和Carpenter&#8217;s Complete Guide to the SAS Macro Language  </li>
<li>Data Step—basic knowledge of data step——对SAS数据步的基本了解，参见一篇SUGI21的文章，Thomas Miron的<a href="http://www.lexjansen.com/sugi/sugi21/at/026-21.pdf" target="_blank">The Secret Lift of the Data Step</a> </li>
<li>Data file manipulation—INFILE, UPDATE, SET intricacies etc ——数据文件操作语句，如infile、update、set等 </li>
<li>ODS——SAS输出传送系统(Output Delivery System)  </li>
<li>Efficiency——编程效率  </li>
<li>Data Step Vector—How it works——理解数据步的运行原理，参见2  </li>
<li>Macros—Knowing how to write macros that write SAS programs——如何写宏语句  </li>
<li>System Development Life Cycle process——这里讲软件开发流程了，作者甚至列出了Steve McConnell的代码大全(Code Complete)，在程序员中流传甚广。  </li>
<li>SAS Help—How to get it——利用SAS的联机帮助文档  </li>
<li>Proc Report——程序步，设计报表  </li>
<li>SQL Dictionary tables—basic of retrieving SAS metadata— 用SQL语句管理数据词典（原数据，metadata），可以参见Frank C. DiIorio 和Nancy J. Michal的<a href="http://www.lexjansen.com/sugi/sugi21/at/032-21.pdf">Data about Data: An Introduction to Dictionary Tables</a> </li>
<li>Proc Summary/Means——程序步，汇总和均值  </li>
<li>Debugging Techniques-DEBUG facility and other techniques——程序调试  </li>
<li>Proc SQL——SQL语句  </li>
<li>Structured programming concepts——结构化编程  </li>
<li>Proc Format——格式输入语句  </li>
<li>Relational Database Design——数据库设计  </li>
<li>Web technology—HTML, JavaScript, SAS IntrNet, ect——网络技术，一些脚本语言  </li>
<li>Your Operating System native (and other) languages—REXX, Unix scripts, VBScript, syncsort——跟操作系统相关的一些脚本语句  </li>
<li>Proc Transpose——数据转置  </li>
<li>Data step reports—&quot;Data _null_&quot; report writing——  </li>
<li>SCL—SCL Functions usable in e.g.,Base SAS data steps——屏幕控制语句</li>
</ol>
<p>上面10，或者22条，要强调的都是，SAS Base是一个好的SAS程序员需要掌握的几乎所有的东西。
<div style="margin:0px;padding:0px;display:inline">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a></div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/12/29/sas%e7%a8%8b%e5%ba%8f%e5%91%98%e5%bf%85%e5%a4%87%e7%9a%84%e5%8d%81%e5%a4%a7%e6%8a%80%e5%b7%a7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SAS Base 金融函数</title>
		<link>http://www.jiangtanghu.com/cn/2007/11/10/sas-base-%e9%87%91%e8%9e%8d%e5%87%bd%e6%95%b0/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/11/10/sas-base-%e9%87%91%e8%9e%8d%e5%87%bd%e6%95%b0/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9948</guid>
		<description><![CDATA[SAS Base一共有23个金融函数，直接转过来没了表格的样子，索性贴图：
 
Technorati Tags: SAS Base, 金融函数, Financial Functions
]]></description>
			<content:encoded><![CDATA[<p>SAS Base一共有23个金融函数，直接转过来没了表格的样子，索性贴图：</p>
<p><a href="http://byfiles.storage.msn.com/y1pw_00XKRSxLxRtoefyCTTGYrwioP4IeukIa7wDa_FdLVd8ouDp9bDtB82lVddxhlr2tvGjMyR4aU"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height="471" alt="base" src="http://byfiles.storage.msn.com/y1pw_00XKRSxLyU5Wp7tWY1jTbimEwsGpnLMrWVhTByk4cmp40CM004g5OUsMbU2IgoYUtH4aWn-x8" width="650" border="0" /></a> </p>
<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS Base" rel="tag">SAS Base</a>, <a href="http://technorati.com/tags/%e9%87%91%e8%9e%8d%e5%87%bd%e6%95%b0" rel="tag">金融函数</a>, <a href="http://technorati.com/tags/Financial Functions" rel="tag">Financial Functions</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/11/10/sas-base-%e9%87%91%e8%9e%8d%e5%87%bd%e6%95%b0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>答客问：SAS对列求和</title>
		<link>http://www.jiangtanghu.com/cn/2007/11/07/%e7%ad%94%e5%ae%a2%e9%97%ae%ef%bc%9asas%e5%af%b9%e5%88%97%e6%b1%82%e5%92%8c/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/11/07/%e7%ad%94%e5%ae%a2%e9%97%ae%ef%bc%9asas%e5%af%b9%e5%88%97%e6%b1%82%e5%92%8c/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9947</guid>
		<description><![CDATA[SAS Base自带的累加函数SUM，虽然有漂亮的缩写方式如SUM(of x1-x100000)，但几乎没有什么应用价值（除了在数组array下），因为SUM函数是对行求和，而在通常的二维表中，我们经常需要对列求和。这个问题用proc SQL过程最为方便，还有一个简单的替代方案就是在proc print步下使用SUM选项。比如，对count求和:
data a;    input ID sex $ count;cards;1 M 32 F 43 M 54 F 5;proc print data=a;    sum count;run; 

结果显示：
Obs    ID    sex    count  
 1      1     M        3 2      2     F        4 3      3     M        5 4      4     F        5                    =====                      17 

如果想按sex分组显示，则先对sex排序：

proc sort data=a;    by sex;run;proc print data=a;    sum count;    by sex;run;

结果显示：

&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; sex=F [...]]]></description>
			<content:encoded><![CDATA[<p>SAS Base自带的累加函数SUM，虽然有漂亮的缩写方式如SUM(of x1-x100000)，但几乎没有什么应用价值（除了在数组array下），因为SUM函数是对行求和，而在通常的二维表中，我们经常需要对列求和。这个问题用proc SQL过程最为方便，还有一个简单的替代方案就是在proc print步下使用SUM选项。比如，对count求和:</p>
<blockquote><p>data a;<br />    input ID sex $ count;<br />cards;<br />1 M 3<br />2 F 4<br />3 M 5<br />4 F 5<br />;<br />proc print data=a;<br />    sum count;<br />run; </p>
</blockquote>
<p>结果显示：</p>
<blockquote><p>Obs    ID    sex    count  </p>
<p> 1      1     M        3<br /> 2      2     F        4<br /> 3      3     M        5<br /> 4      4     F        5<br />                    =====<br />                      17 </p>
</blockquote>
<p>如果想按sex分组显示，则先对sex排序：<br />
<blockquote>
<p>proc sort data=a;<br />    by sex;<br />run;<br />proc print data=a;<br />    sum count;<br />    by sex;<br />run;</p>
</blockquote>
<p>结果显示：<br />
<blockquote>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; sex=F &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;  </p>
<p>                                         Obs    ID    count  </p>
<p>                                           1     2      4<br />                                           2     4      5<br />                                         &#8212;          &#8212;&#8211;<br />                                         sex            9  </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- sex=M &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;  </p>
<p>                                         Obs    ID    count  </p>
<p>                                           3     1       3<br />                                           4     3       5<br />                                         &#8212;          &#8212;&#8211;<br />                                         sex             8<br />                                                      =====<br />                                                        17 </p>
</blockquote>
<p>当然，你可以让结果更紧凑些，比如在proc print中的by sex下面再加一个id sex，看起来就是这样：<br />
<blockquote>
<p>sex    ID    count  </p>
<p> F      2       4<br />        4       5<br />&#8212;          &#8212;&#8211;<br /> F              9  </p>
<p> M      1       3<br />        3       5<br />&#8212;          &#8212;&#8211;<br /> M              8<br />             =====<br />               17 </p>
</blockquote>
<div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a>, <a href="http://technorati.com/tags/SUM" rel="tag">SUM</a>, <a href="http://technorati.com/tags/SQL" rel="tag">SQL</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/11/07/%e7%ad%94%e5%ae%a2%e9%97%ae%ef%bc%9asas%e5%af%b9%e5%88%97%e6%b1%82%e5%92%8c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SAS备忘录：format和informat</title>
		<link>http://www.jiangtanghu.com/cn/2007/10/30/sas%e5%a4%87%e5%bf%98%e5%bd%95%ef%bc%9aformat%e5%92%8cinformat/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/10/30/sas%e5%a4%87%e5%bf%98%e5%bd%95%ef%bc%9aformat%e5%92%8cinformat/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9946</guid>
		<description><![CDATA[       被问到informat和format的用法和区别。都是关于变量属性的，以前讲过informat影响到SAS输入数据的格式，而format影响到数据的输出格式。还是不直观，说个能操作的简单例子。
       先说format。format影响到SAS的数据输出格式，这个我们举了个例子，输出当前时间：
data time;x=date();format x yymmdd8.2;put x=;run;

      如果没有format那行，那么SAS系统就会把当前时间输出为一个数字（因为SAS就是用数字存储日期的），format就是指定x的输出格式，以便于我们阅读。
      format是改变输出格式，而informat则是关于SAS的读入格式。举个例子，假如你的D盘有个文本数据文件informat.txt，存的是一个时间变量time，有两个观测值：
time1998-7-10 1998-7-11

      你要是这么读入它，就会出错：
data a;infile &#34;d:\informat.txt&#34; firstobs=2;  input time;run;

       先解释一下这段。这是一个标准的读入数据的程序，infile &#34;d:\informat.txt&#34;指明文件路径，后面的firstobs=2表明数据从第二行开始读入（因为第一行是变量名time）。如果是数值型的变量，这一定没问题，但这个time的格式是1998-7-11，SAS就读不了，如果不指定time的读入格式。        规定读入格式，就要用到informat了，下面的程序就能正确读入informat.txt了：
data aa;infile &#34;d:\informat.txt&#34; firstobs=2;input time;informat time yymmdd10.;run;

        informat time yymmdd10.就规定了time的读入格式，SAS系统就知道它存的是时间，就读进来了。读是读进来了，但这是SAS显示的却也是数字。为了让输出我们能明白，就要用到format，改变输出格式，完整的程序如下：
 data aaa;infile &#34;d:\informat.txt&#34; firstobs=2;input time;informat time yymmdd10.;format time yymmdd10.;run;

Technorati Tags: SAS, informat, format
]]></description>
			<content:encoded><![CDATA[<p>       被问到informat和format的用法和区别。都是关于变量属性的，<a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!276.entry">以前讲</a>过informat影响到SAS输入数据的格式，而format影响到数据的输出格式。还是不直观，说个能操作的简单例子。</p>
<p>       先说format。format影响到SAS的数据输出格式，这个我们举了个例子，输出当前时间：</p>
<blockquote><p>data time;<br />x=date();<br />format x yymmdd8.2;<br />put x=;<br />run;</p>
</blockquote>
<p>      如果没有format那行，那么SAS系统就会把当前时间输出为一个数字（因为SAS就是用数字存储日期的），format就是指定x的输出格式，以便于我们阅读。</p>
<p>      format是改变输出格式，而informat则是关于SAS的读入格式。举个例子，假如你的D盘有个文本数据文件informat.txt，存的是一个时间变量time，有两个观测值：</p>
<blockquote><p>time<br />1998-7-10 <br />1998-7-11</p>
</blockquote>
<p>      你要是这么读入它，就会出错：</p>
<blockquote><p>data a;<br />infile &quot;d:\informat.txt&quot; firstobs=2;  <br />input time;<br />run;</p>
</blockquote>
<p>       先解释一下这段。这是一个标准的读入数据的程序，infile &quot;d:\informat.txt&quot;指明文件路径，后面的firstobs=2表明数据从第二行开始读入（因为第一行是变量名time）。如果是数值型的变量，这一定没问题，但这个time的格式是1998-7-11，SAS就读不了，如果不指定time的读入格式。 <br />       规定读入格式，就要用到informat了，下面的程序就能正确读入informat.txt了：</p>
<blockquote><p>data aa;<br />infile &quot;d:\informat.txt&quot; firstobs=2;<br />input time;<br />informat time yymmdd10.;<br />run;</p>
</blockquote>
<p>        informat time yymmdd10.就规定了time的读入格式，SAS系统就知道它存的是时间，就读进来了。读是读进来了，但这是SAS显示的却也是数字。为了让输出我们能明白，就要用到format，改变输出格式，完整的程序如下：</p>
<blockquote><p> <br />data aaa;<br />infile &quot;d:\informat.txt&quot; firstobs=2;<br />input time;<br />informat time yymmdd10.;<br />format time yymmdd10.;<br />run;</p>
</blockquote>
<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a>, <a href="http://technorati.com/tags/informat" rel="tag">informat</a>, <a href="http://technorati.com/tags/format" rel="tag">format</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/10/30/sas%e5%a4%87%e5%bf%98%e5%bd%95%ef%bc%9aformat%e5%92%8cinformat/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to pronounce SAS ?</title>
		<link>http://www.jiangtanghu.com/cn/2007/10/19/how-to-pronounce-sas/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/10/19/how-to-pronounce-sas/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9944</guid>
		<description><![CDATA[一直用SAS，一直公开把它念成煞斯，旁边的朋友都这么念了。当然，一般看到a,最好都念成“贰”，而不是“啊”，有个讲究，美国一些教授好像有个“刻版印象”（偏见），比如说Harvard的第一个ar，不要念成“啊”，而要念为“贰”，这样据说显得高雅。SAS这个a似乎是念成“贰”而不是“啊”，它的老板 “晚安”（Jim Goodnight）在一次视频上读过，注意了一下，那个a好像是念成“贰。
刚不小心进入了一个佐治亚大学(the University of Georgia)的SAS邮件组，1997年初的帖子，看着也有不少人对SAS的发音感兴趣，挺好玩的，贴出来，把名字隐去，以前我们也在人大“统计之都”论坛讨论过stata和SAS的发音： 

Hi, A simple question: How should I pronounce SAS: is
it Es-A-ES of just SAS ?
提问：SAS是把它拆成三个字母单独念，还是连在一起念SAS？
It's pronounced as a single word, &#34;sass&#34; (rhymes with mass, pass, lass,
gas, etc.).  This goes along with the official SAS Institute position that (for
legal reasons) SAS is not an abbreviation or acronym for anything.
回帖1：认为SAS要连在一起念，念起来跟sass（顶嘴）、mass（大众）、lass（女佣）差不多。
这是因为现在SAS已经不是statistics analysis [...]]]></description>
			<content:encoded><![CDATA[<p>一直用SAS，一直公开把它念成煞斯，旁边的朋友都这么念了。当然，一般看到a,最好都念成“贰”，而不是“啊”，有个讲究，美国一些教授好像有个“刻版印象”（偏见），比如说Harvard的第一个ar，不要念成“啊”，而要念为“贰”，这样据说显得高雅。SAS这个a似乎是念成“贰”而不是“啊”，它的老板 “晚安”（Jim Goodnight）在一次视频上读过，注意了一下，那个a好像是念成“贰。</p>
<p>刚不小心进入了一个佐治亚大学(the University of Georgia)的<a href="http://www.listserv.uga.edu/cgi-bin/wa?A1=ind9702c&amp;L=sas-l#39">SAS邮件组</a>，1997年初的帖子，看着也有不少人对SAS的发音感兴趣，挺好玩的，贴出来，把名字隐去，以前我们也在人大“统计之都”论坛讨论过<a href="http://www.cos.name/bbs/read.php?tid=5872&amp;fpage=3">stata和SAS的发音</a>： </p>
<p>
<pre>Hi, A simple question: How should I pronounce SAS: is
it Es-A-ES of just SAS ?</pre>
<pre>提问：SAS是把它拆成三个字母单独念，还是连在一起念SAS？</pre>
<pre>It's pronounced as a single word, &quot;sass&quot; (rhymes with mass, pass, lass,
gas, etc.).  This goes along with the official SAS Institute position that (for
legal reasons) SAS is not an abbreviation or acronym for anything.</pre>
<pre>回帖1：认为SAS要连在一起念，念起来跟sass（顶嘴）、mass（大众）、lass（女佣）差不多。</pre>
<pre>这是因为现在SAS已经不是statistics analysis system的缩写，本身就是一个商标。</pre>
<pre>There is an economist here that always refers to SAS as Es-A-ES.
He doesn't use it -- just makes derogatory comments about it.
We kid him about his statistical package: &quot;Yeah, but can
S-T-A-T-A do this?!?&quot;</pre>
<pre>回帖2：讲了一个笑话。一个损贬SAS的经济学家，把SAS拆开来读成Es-A-Es。</pre>
<pre>就打趣把他用的stata（斯得他）也分开念成s-t-a-t-a</pre>
<pre>Apart from which, a British person might get confused if you used S-A-S
with a military unit of the same pronunciation! Use SASS.</pre>
<pre>回帖3：英国的SAS是皇家空军特勤处(Special Air Service)的缩写。</pre>
<pre>

One syllable.  Rhymes with........mass.
Just SAS.
Most people I know pronounce it as &quot;sass&quot;.  A few say &quot;saz&quot;.
Nobody would know what the heck I was talking about if I
spelled out S-A-S.

</pre>
<pre>Might suggest to the erudite economist that if he doesn't know how to
pronounce it then he must not know much else about it.</pre>
</p>
<p><div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a>, <a href="http://technorati.com/tags/how to pronounce SAS" rel="tag">how to pronounce SAS</a></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/10/19/how-to-pronounce-sas/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SAS Macro的面对对象解释-一个附会</title>
		<link>http://www.jiangtanghu.com/cn/2007/09/18/sas-macro%e7%9a%84%e9%9d%a2%e5%af%b9%e5%af%b9%e8%b1%a1%e8%a7%a3%e9%87%8a-%e4%b8%80%e4%b8%aa%e9%99%84%e4%bc%9a/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/09/18/sas-macro%e7%9a%84%e9%9d%a2%e5%af%b9%e5%af%b9%e8%b1%a1%e8%a7%a3%e9%87%8a-%e4%b8%80%e4%b8%aa%e9%99%84%e4%bc%9a/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9940</guid>
		<description><![CDATA[SAS编程语言的非OO特点真是让人头大。昨天突然冒出一个想法，可不可以把宏附会成一个“类”，宏参数就类似“属性”，具体的赋值就相当于一个“成员”，这样思路似乎就似乎清楚些。
Technorati Tags: SAS, Micro, oop, 面对对象
]]></description>
			<content:encoded><![CDATA[<p>SAS编程语言的非OO特点真是让人头大。昨天突然冒出一个想法，可不可以把宏附会成一个“类”，宏参数就类似“属性”，具体的赋值就相当于一个“成员”，这样思路似乎就似乎清楚些。</p>
<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a>, <a href="http://technorati.com/tags/Micro" rel="tag">Micro</a>, <a href="http://technorati.com/tags/oop" rel="tag">oop</a>, <a href="http://technorati.com/tags/%e9%9d%a2%e5%af%b9%e5%af%b9%e8%b1%a1" rel="tag">面对对象</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/09/18/sas-macro%e7%9a%84%e9%9d%a2%e5%af%b9%e5%af%b9%e8%b1%a1%e8%a7%a3%e9%87%8a-%e4%b8%80%e4%b8%aa%e9%99%84%e4%bc%9a/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SAS学习笔记（4）:Editing and Debugging SAS Programs</title>
		<link>http://www.jiangtanghu.com/cn/2007/09/15/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%884%ef%bc%89editing-and-debugging-sas-programs/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/09/15/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%884%ef%bc%89editing-and-debugging-sas-programs/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9939</guid>
		<description><![CDATA[以前的东西：  
SAS OnlineTutor®: Basic and Intermediate SAS®的learning path见《SAS学习笔记：开篇》 
SAS学习笔记（1）：Basic Concepts 
SAS学习笔记（2）：Using the Programming Workspace 
SAS学习笔记（3）:Referencing Files and Setting Options 
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
General form, basic INCLUDE command: INCLUDE &#8216;file-specification&#8217;  
where file-specification is the physical name by which the host system recognizes the file.  
Because this is a command (not a SAS statement), no semicolon is [...]]]></description>
			<content:encoded><![CDATA[<p>以前的东西：  </p>
<p>SAS OnlineTutor<sup>®</sup>: Basic and Intermediate SAS<sup>®</sup>的learning path见<a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!275.entry">《SAS学习笔记：开篇》</a> </p>
<p><a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!276.entry">SAS学习笔记（1）：Basic Concepts</a> </p>
<p><a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!286.entry">SAS学习笔记（2）：Using the Programming Workspace</a> </p>
<p><a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!298.entry">SAS学习笔记（3）:Referencing Files and Setting Options</a> </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p><strong>General form, basic INCLUDE command:</strong> <strong>INCLUDE </strong><em>&#8216;file-specification&#8217; </em> </p>
<p>where <em>file-specification</em> is the physical name by which the host system recognizes the file.  </p>
<p>Because this is a command (not a SAS statement), no semicolon is used at the end.  </p>
<p><strong>SAS Program Structure</strong>
<ul>
<li>begin DATA and PROC steps in column one  </li>
<li>indent statements within a step  </li>
<li>begin RUN statements in column one  </li>
<li>include a RUN statement after every DATA step or PROC step. </li>
</ul>
<p><strong>Error Types</strong> </p>
<p>So far, the programs that you&#8217;ve submitted in this lesson have been error-free, but programming errors do occur. SAS can detect several types of errors. The most common are
<ul>
<li><strong>syntax errors</strong> that occur when program statements do not conform to the rules of the SAS language  </li>
<li><strong>data errors</strong> that occur when some data values are not appropriate for the SAS statements that are specified in a program. </li>
</ul>
<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS%e8%ae%a4%e8%af%81" rel="tag">SAS认证</a>, <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/09/15/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%884%ef%bc%89editing-and-debugging-sas-programs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAS学习笔记（3）:Referencing Files and Setting Options</title>
		<link>http://www.jiangtanghu.com/cn/2007/09/14/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%883%ef%bc%89referencing-files-and-setting-options/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/09/14/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%883%ef%bc%89referencing-files-and-setting-options/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9937</guid>
		<description><![CDATA[以前的东西：  
SAS OnlineTutor®: Basic and Intermediate SAS®的learning path见《SAS学习笔记：开篇》 
SAS学习笔记（1）：Basic Concepts 
SAS学习笔记（2）：Using the Programming Workspace 
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;

General form, basic LIBNAME statement: LIBNAME libref  &#8216;SAS-data-library&#8216;;   
The LIBNAME statement is global, which means that the librefs remain in effect until you modify them, cancel them, or end your SAS session.Therefore, the LIBNAME statement assigns the libref for the [...]]]></description>
			<content:encoded><![CDATA[<p>以前的东西：  </p>
<p>SAS OnlineTutor<sup>®</sup>: Basic and Intermediate SAS<sup>®</sup>的learning path见<a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!275.entry">《SAS学习笔记：开篇》</a> </p>
<p><a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!276.entry">SAS学习笔记（1）：Basic Concepts</a> </p>
<p><a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!286.entry">SAS学习笔记（2）：Using the Programming Workspace</a> <br />
<h6>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</h6>
</p>
<p><strong>General form, basic LIBNAME statement:</strong> <strong>LIBNAME </strong><em>libref  </em><strong>&#8216;</strong><em>SAS-data-library</em><strong>&#8216;;</strong>   </p>
<p>The LIBNAME statement is <strong>global</strong>, which means that the librefs remain in effect until you modify them, cancel them, or end your SAS session.Therefore, the LIBNAME statement assigns the libref for the current SAS session only. Each time you begin a SAS session, you must assign a libref to each permanent SAS data library that contains files that you want to access in that session. (Remember that <strong>Work</strong> is the default libref for a temporary SAS data library.)When you end your SAS session or delete a libref, SAS no longer has access to the files in the library. However, the contents of the library still exist on your operating system.</p>
<p>Remember that you can also assign a library from the SAS Explorer using the New Library window (as you did if you completed the lesson <strong>Basic Concepts </strong>). Libraries that are created with the New Library window can be automatically assigned at startup by selecting <strong>Enable at Startup</strong>.</p>
<p><strong>General form, basic PROC CONTENTS step:</strong> <strong>PROC CONTENTS DATA=</strong><em>SAS-file-specification</em><strong> NODS;</strong><strong>RUN</strong><em></em><strong>;</strong>   </p>
<p>PROC CONTENTS and PROC DATASETS overlap in terms of functionality. Generally, these two function the same:
<ul>
<li>the <strong>CONTENTS procedure</strong> </li>
<li>the <strong>CONTENTS statement in the DATASETS procedure</strong>. </li>
</ul>
<p><strong>PROC CONTENTS </strong>&lt;<em>options</em>&gt;;<strong>RUN</strong>;  </p>
<p><strong>PROC DATASETS </strong>&lt;<em>options</em>&gt;;<strong>CONTENTS </strong>&lt;<em>options</em>&gt;;<strong>QUIT;</strong> </p>
<p>The major difference between the CONTENTS procedure and the CONTENTS statement in PROC DATASETS is the default for <em>libref</em> in the DATA= option. For PROC CONTENTS, the default is either <strong>Work</strong> or <strong>User</strong>. For the CONTENTS statement, the default is the libref of the procedure input library. Notice also that PROC DATASETS is an interactive procedure that requires a QUIT statement rather than a RUN statement.    </p>
<p>y default, PROC CONTENTS and PROC DATASETS list variables <strong>alphabetically</strong>. To list variable names in the order of their <strong>logical</strong> position (or creation order) in the data set, you can specify the <strong>VARNUM option</strong> in PROC CONTENTS or in the CONTENTS statement in PROC DATASETS.</p>
<p>If you use <strong>two-digit year values</strong> in your data lines, external files, or programming statements, you should consider another important system option, the <strong>YEARCUTOFF= option</strong>. This option specifies which 100-year span is used to interpret two-digit year values.  </p>
<p><img height="86" alt="100-year span" src="http://tutor.vicp.cc/N8er39YTm0/60476/m16/images/m16c5g1.gif" width="498" /> </p>
<p>All versions of SAS represent dates correctly from 1582 A.D. to 20,000 A.D. (Leap years, century, and fourth-century adjustments are made automatically. Leap seconds are ignored, and SAS does not adjust for Daylight Savings Time.) However, you should be aware of the YEARCUTOFF= value to ensure that you are properly interpreting two-digit years in data lines.  </p>
<p>As with other system options, you specify the YEARCUTOFF= option in the OPTIONS statement:
<pre>     options yearcutoff=1925;</pre>
</p>
<p>When a two-digit year value is read, SAS interprets it based on a 100-year span which starts with the YEARCUTOFF= value. The default value of YEARCUTOFF= is <strong>1920</strong>.
</p>
<p><img height="40" alt="Default 100-year span" src="http://tutor.vicp.cc/N8er39YTm0/60476/m16/images/m16c6g1.gif" width="195" border="0" /> 
</p>
<p>However, you can override the default and change the value of YEARCUTOFF=  to the first year of another 100-year span. For example, if you specify YEARCUTOFF=1950, then the 100-year span will be from 1950 to 2049.
<pre>     options yearcutoff=1950;</pre>
<p>Using YEARCUTOFF=1950, dates are interpreted as shown below:
</p>
<p><img height="40" alt="Modified 100-year span" src="http://tutor.vicp.cc/N8er39YTm0/60476/m16/images/m16c6g2.gif" width="195" border="0" />
</p>
<p>Remember, the value of the YEARCUTOFF= system option affects only <strong>two-digit year values</strong>. A date value that contains a four-digit year value will be interpreted correctly even if it does not fall within the 100-year span set by the YEARCUTOFF= system option.
</p>
<p><strong>General form, FIRSTOBS= and OBS= options in an OPTIONS statement:</strong></p>
<blockquote><p><strong>FIRSTOBS=</strong><em>n</em></p>
<p><strong>OBS=</strong><em>n</em></p>
</blockquote>
<p>where <em>n</em> is a positive integer. For FIRSTOBS=, <em>n</em> specifies the number of the <strong>first</strong> observation to process. For OBS=, <em>n</em> specifies the number of the <strong>last</strong> observation to process. By default, FIRSTOBS=1. The default value for OBS= is MAX, which is the largest signed, four-byte integer that is representable in your operating environment.</p>
<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS%e8%ae%a4%e8%af%81" rel="tag">SAS认证</a>, <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/09/14/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%883%ef%bc%89referencing-files-and-setting-options/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SAS学习笔记（2）：Using the Programming Workspace</title>
		<link>http://www.jiangtanghu.com/cn/2007/09/12/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%882%ef%bc%89%ef%bc%9ausing-the-programming-workspace/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/09/12/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%882%ef%bc%89%ef%bc%9ausing-the-programming-workspace/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9934</guid>
		<description><![CDATA[SAS OnlineTutor®: Basic and Intermediate SAS®的learning path见《SAS学习笔记：开篇》 
SAS学习笔记（1）：Basic Concepts 
这一集没什么好看的，就是SAS的编程环境，熟悉各种窗口就是。需要清楚的是什么是Output窗口，什么是Result窗口。 
The Output Window  
You can create two basic types of SAS output: a listing, which is traditional SAS output, an HTML document. 
In the Output window, you browse listing output from SAS programs that you submit. (You can use a browser to view HTML [...]]]></description>
			<content:encoded><![CDATA[<p>SAS OnlineTutor<sup>®</sup>: Basic and Intermediate SAS<sup>®</sup>的learning path见<a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!275.entry">《SAS学习笔记：开篇》</a> </p>
<p><a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!276.entry">SAS学习笔记（1）：Basic Concepts</a> </p>
<p>这一集没什么好看的，就是SAS的编程环境，熟悉各种窗口就是。需要清楚的是什么是Output窗口，什么是Result窗口。 </p>
<p><b>The Output Window </b> </p>
<p>You can create two basic types of SAS output: a listing, which is traditional SAS output, an HTML document. </p>
<p>In the Output window, you browse listing output from SAS programs that you submit. (You can use a browser to view HTML output.)  </p>
<p>By default, the Output window is positioned behind the code editing and Log windows. </p>
<p><b>The Results Window </b> </p>
<p>The Results window helps you navigate and manage output from SAS programs that you submit. You can view, save, and print individual items of output.  </p>
<p>On most operating systems, the Results window is positioned behind the Explorer window and is empty until you submit a SAS program that creates output. Then the Results window moves to the front of your display.  </p>
<p>The Results window displays separate icons for listing output and HTML output. In the example below, the first Print folder contains both types of output.  </p>
<p>一句话，区别在于: </p>
<p>The Results window displays a tree view of output that is created during a SAS session. The Output window displays the output itself.</p>
<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS%e8%ae%a4%e8%af%81" rel="tag">SAS认证</a>, <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/09/12/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%882%ef%bc%89%ef%bc%9ausing-the-programming-workspace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAS学习笔记（1）：Basic Concepts</title>
		<link>http://www.jiangtanghu.com/cn/2007/09/03/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%881%ef%bc%89%ef%bc%9abasic-concepts/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/09/03/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%881%ef%bc%89%ef%bc%9abasic-concepts/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9932</guid>
		<description><![CDATA[SAS OnlineTutor®: Basic and Intermediate SAS®的learning path见《SAS学习笔记：开篇》。
SAS Programs 
A SAS program can consist of a DATA step or a PROC step or any combination of DATA and PROC steps.  
DATA steps typically create or modify SAS data sets. They can also be used to produce custom-designed reports.  
PROC (procedure) steps are pre-written routines that [...]]]></description>
			<content:encoded><![CDATA[<p>SAS OnlineTutor<sup>®</sup>: Basic and Intermediate SAS<sup>®</sup>的learning path见<a href="http://johnthu.spaces.live.com/blog/cns!2053CD511E6D5B1E!275.entry">《SAS学习笔记：开篇》</a>。</p>
<p><img height="1" alt=" " src="http://tutor.vicp.cc/N8er39YTm0/60476/navimages/cleardot.gif" width="411" /><br /><strong>SAS Programs</strong> </p>
<p>A SAS program can consist of a DATA step or a PROC step or any combination of DATA and PROC steps.  </p>
<p><strong><a>DATA steps </a></strong>typically create or modify SAS data sets. They can also be used to produce custom-designed reports.  </p>
<p><strong><a>PROC (procedure) steps</a></strong> are pre-written routines that enable you to analyze and process the data in a SAS data set and to present the data in the form of a report. They sometimes create new SAS data sets that contain the results of the procedure. PROC steps can list, sort, and summarize data.  </p>
<p>SAS programs consist of <strong>SAS statements</strong>. A SAS statement has two important characteristics:
<ul>
<li>It usually begins with a SAS <strong>keyword</strong>.  </li>
<li>It always ends with a <strong>semicolon</strong>. </li>
</ul>
<p>A DATA step begins with a DATA statement, which begins with the keyword DATA. A PROC step begins with a PROC statement, which begins with the keyword PROC.  </p>
<p>SAS statements are free-format. This means that
<ul>
<li>they can begin and end anywhere on a line  </li>
<li>one statement can continue over several lines  </li>
<li>several statements can be on a line. </li>
</ul>
<p>Blanks or special characters separate &quot;words&quot; in a SAS statement.  </p>
<p>DATA and PROC statements signal the beginning of a new step. When SAS encounters a subsequent DATA, PROC, or RUN statement (for DATA steps and most procedures) or a QUIT statement (for some procedures), SAS stops reading statements and executes the previous step in the program. In our sample program, each step ends with a RUN statement.</p>
<p>The beginning of a new step (DATA or PROC) implies the end of the previous step. Though the RUN statement is not always required between steps in a SAS program, using it can make the SAS program easier to read and debug, and it makes the SAS log easier to read.</p>
<p><img height="1" alt=" " src="http://tutor.vicp.cc/N8er39YTm0/60476/navimages/cleardot.gif" width="411" /><br /><strong>SAS Libraries</strong> </p>
<p>Every SAS file is stored in a <strong>SAS library</strong>, which is a collection of SAS files. A SAS data library is the highest level of organization for information within SAS.  </p>
<p>SAS libraries have different implementations depending on your operating environment, but a library generally corresponds to the level of organization that your host operating system uses to access and store files. In some operating environments, a library is a physical collection of files. In others, the files are only logically related.  </p>
<p><strong>Windows</strong>, <strong>UNIX</strong>, <strong>OpenVMS, OS/2</strong>(directory based-systems)  </p>
<p>a group of SAS files that are stored in the same directory. Other files can be stored in the directory, but only the files that have SAS file extensions are recognized as part of the SAS data library.  </p>
<p><strong>CMS: </strong>a group of SAS files that have the same file type.  </p>
<p><strong>z/OS (OS/390): </strong>a specially formatted host data set in which only SAS files are stored.  </p>
<p>Depending on the library name that you use when you create a file, you can store SAS files temporarily or permanently.  </p>
<p><strong><a>Storing files temporarily:</a>  </strong>If you don&#8217;t specify a library name when you create a file (or if you specify the library name <strong>Work</strong>), the file is stored in the temporary SAS data library. When you end the session, the temporary library and all of its files are deleted.  </p>
<p><strong><a>Storing files permanently:</a>  </strong>To store files permanently in a SAS data library, you specify a library name other than the default library name <strong>Work</strong>.  </p>
<p><img height="1" alt=" " src="http://tutor.vicp.cc/N8er39YTm0/60476/navimages/cleardot.gif" width="411" /><br /><strong>Referencing SAS Files</strong> </p>
<p>To reference a permanent SAS data set in your SAS programs, you use a <strong>two-level name</strong>: <strong><em>libref.filename. </em></strong>In the two-level name, <em>libref</em> is the name of the SAS data library that contains the file, and <em>filename</em> is the name of the file itself. A period separates the libref and filename.  </p>
<p>To reference temporary SAS files, you can specify the default libref <strong>Work</strong>, a period, and the filename. For example, the two-level name <strong>Work.Test</strong> references the SAS data set named <strong>Test</strong> that is stored in the temporary SAS library <strong>Work</strong>. Alternatively, you can simply use a <strong>one-level name</strong> (the filename only) to reference a file in a temporary SAS library. When you specify a one-level name, the default libref <strong>Work</strong> is assumed.</p>
<p><strong><a>Rules for SAS Names</a>: </strong>SAS data set names
<ul>
<li>can be 1 to 32 characters long  </li>
<li>must begin with a letter (A-Z, either uppercase or lowercase) or an underscore (_)  </li>
<li>can continue with any combination of numbers, letters, or underscores. </li>
</ul>
<p><img height="1" alt=" " src="http://tutor.vicp.cc/N8er39YTm0/60476/navimages/cleardot.gif" width="411" /><br /><strong></strong><strong>SAS Data Sets</strong> </p>
<p>A SAS data set is a file that consists of two parts: a <strong>descriptor portion</strong> and a <strong>data portion</strong>.</p>
<p>The descriptor portion of a SAS data set contains information about the data set, including
<ul>
<li>the name of the data set  </li>
<li>the date and time that the data set was created  </li>
<li>the number of observations  </li>
<li>the number of variables. </li>
</ul>
<p>The data portion of a SAS data set is a collection of data values that are arranged in a rectangular table.</p>
<p><strong>Rows</strong> (called <strong>observations</strong>) in the data set are collections of data values that usually relate to a single object.</p>
<p><strong>Columns</strong> (called <strong>variables</strong>) in the data set are collections of values that describe a particular characteristic.</p>
<p><img height="1" alt=" " src="http://tutor.vicp.cc/N8er39YTm0/60476/navimages/cleardot.gif" width="411" /><br /><strong>Variable Attributes</strong> </p>
<p><strong>Name: </strong>Each variable has a name that conforms to SAS naming conventions. Variable names follow exactly the same rules as SAS data set names. Like data set names, variable names
<ul>
<li>can be 1 to 32 characters long  </li>
<li>must begin with a letter (A-Z, either uppercase or lowercase) or an underscore (_)  </li>
<li>can continue with any combination of numbers, letters, or underscores. </li>
</ul>
<p><strong>Type: </strong>A variable&#8217;s type is either <strong>character</strong> or <strong>numeric</strong>.
<ul>
<li>Character variables, such as <code>Name</code> (shown below), can contain <strong>any values</strong>.  </li>
<li>Numeric variables, such as <code>Policy</code> and <code>Total</code> (shown below), can contain <strong>only numeric values </strong>(the digits 0 through 9, +, -, ., and E for scientific notation). </li>
</ul>
<p>A variable&#8217;s type determines how missing values for a variable are displayed. In the following data set, <code>Name</code> and <code>Sex</code> are character variables, and <code>Age</code> and <code>Weight</code> are numeric variables.
<ul>
<li>For character variables such as <code>Name</code>, a <strong>blank</strong> represents a missing value.  </li>
<li>For numeric variables such as <code>Age</code>, a <strong>period</strong> represents a missing value. </li>
</ul>
<p><a><strong>Length</strong></a>: A variable&#8217;s <strong>length </strong>(the number of bytes used to store it) is related to its type.
<ul>
<li>Character variables can be up to <strong>32K</strong> long. In the exa<br />
mple below, <code>Name</code> has a length of 20 characters and uses 20 bytes of storage.  </li>
<li>All numeric variables have a default length of <strong>8</strong>. Numeric values (no matter how many digits they contain) are stored as floating-point numbers in 8 bytes of storage, unless you specify a different length. </li>
</ul>
<p><strong>Format: </strong>Formats are variable attributes that affect the way data values are written. SAS software offers a variety of character, numeric, and date and time formats. You can also create and store your own formats. To write values out using some particular form, you select the appropriate format.  </p>
<p><img height="107" alt="SAS format" src="http://tutor.vicp.cc/N8er39YTm0/60476/navimages/format.gif" width="355" border="0" /> </p>
<p>For example, to display the value <em>1234</em> as $1234.00 in a report, you can use the DOLLAR8.2 format.  </p>
<p><strong>Informat: </strong>Whereas formats write values out using some particular form, <strong>in</strong>formats read data values in certain forms <strong>in</strong>to standard SAS values. Informats determine how data values are read into a SAS data set. You <strong>must</strong> use informats to read numeric values that contain letters or other special characters.  </p>
<p><img height="107" alt="SAS informat" src="http://tutor.vicp.cc/N8er39YTm0/60476/navimages/informat.gif" width="355" border="0" /> </p>
<p>For example, the numeric value <em>$12,345.00</em> contains two special characters, a dollar sign ($) and a comma (,). You can use an informat to read the value while removing the dollar sign and comma, and then store the resulting value as a standard numeric value.  </p>
<p><a><strong>Label</strong></a>: A variable can have a <strong>label</strong>, which consists of descriptive text up to 256 characters long.</p>
<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS%e8%ae%a4%e8%af%81" rel="tag">SAS认证</a>, <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/09/03/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%881%ef%bc%89%ef%bc%9abasic-concepts/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SAS学习笔记：开篇</title>
		<link>http://www.jiangtanghu.com/cn/2007/08/31/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%9a%e5%bc%80%e7%af%87/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/08/31/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%9a%e5%bc%80%e7%af%87/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9931</guid>
		<description><![CDATA[准备SAS程序员认证，从基础开学。材料就是：
SAS OnlineTutor®: Basic and Intermediate SAS® 
Introduction to SAS Programming 
Basic Concepts 
Using the Programming Workspace  
Referencing Files and Setting Options  
Editing and Debugging SAS Programs  
Creating List Reports  
Creating SAS Data Sets from Raw Data  
Understanding DATA Step Processing   
Producing Reports 
Creating and Applying User-Defined Formats  
Creating Enhanced List [...]]]></description>
			<content:encoded><![CDATA[<p>准备SAS程序员认证，从基础开学。材料就是：</p>
<p><strong>SAS OnlineTutor<sup>®</sup>: Basic and Intermediate SAS<sup>®</sup></strong><strong> </strong></p>
<p><strong>Introduction to SAS Programming</strong> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m1/m1_1.htm">Basic Concepts</a> </p>
<p><a>Using the Programming Workspace </a> </p>
<p><a>Referencing Files and Setting Options </a> </p>
<p><a>Editing and Debugging SAS Programs </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m4/m4_1.htm">Creating List Reports </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m12/m12_1.htm">Creating SAS Data Sets from Raw Data </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m22/m22_1.htm">Understanding DATA Step Processing</a>   </p>
<p><strong>Producing Reports</strong> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m31/m31_1.htm">Creating and Applying User-Defined Formats </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m40/m40_1.htm">Creating Enhanced List and Summary Reports </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m41/m41_1.htm">Producing Descriptive Statistics </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m18/m18_1.htm">Producing HTML Output </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m5/m5_1.htm">Creating Tabular Reports </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m11/m11_1.htm">Enhancing HTML Tabular Reports</a> </p>
<p><strong>Producing Graphical Reports</strong><br /><em>These lessons are not suitable for use with SAS Enterprise Guide.</em> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m6/m6_1.htm">Creating Plots </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m7/m7_1.htm">Creating Bar and Pie Charts </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m8/m8_1.htm">Enhancing and Exporting Charts and Plots </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m9/m9_1.htm">Creating Drill-Down Graphs in HTML</a> </p>
<p><strong>Creating and Modifying SAS Data Sets</strong> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m39/m39_1.htm">Creating and Managing Variables </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m14/m14_1.htm">Reading SAS Data Sets </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m20/m20_1.htm">Combining SAS Data Sets </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m10/m10_1.htm">Performing Queries Using PROC SQL </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m30/m30_1.htm">Transforming Data with SAS Functions </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m13/m13_1.htm">Accessing DBMS Data </a><br /><em>This lesson is not suitable for use with SAS Enterprise Guide.</em> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m34/m34_1.htm">Generating Data with DO Loops </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m35/m35_1.htm">Processing Variables with Arrays </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m32/m32_1.htm">Improving Program Efficiency with Macro Variables</a> </p>
<p><strong>Reading Various Types of Raw Data </strong></p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m19/m19_1.htm">Reading Raw Data in Fixed Fields </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m23/m23_1.htm">Reading Free-Format Data </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m24/m24_1.htm">Reading Date and Time Values </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m25/m25_1.htm">Creating a Single Observation from Multiple Records </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m26/m26_1.htm">Creating Multiple Observations from a Single Record </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m27/m27_1.htm">Reading Hierarchical Files </a> </p>
<p><a href="http://tutor.vicp.cc/N8er39YTm0/60476/m28/m28_1.htm">Reading Variable-Length Records</a></p>
<div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/SAS" rel="tag">SAS</a>, <a href="http://technorati.com/tags/SAS%e8%ae%a4%e8%af%81" rel="tag">SAS认证</a>, <a href="http://technorati.com/tags/SAS OnlineTutor" rel="tag">SAS OnlineTutor</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/08/31/sas%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%9a%e5%bc%80%e7%af%87/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAS Logistic回归：一个完整例子</title>
		<link>http://www.jiangtanghu.com/cn/2007/05/04/sas-logistic%e5%9b%9e%e5%bd%92%ef%bc%9a%e4%b8%80%e4%b8%aa%e5%ae%8c%e6%95%b4%e4%be%8b%e5%ad%90/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/05/04/sas-logistic%e5%9b%9e%e5%bd%92%ef%bc%9a%e4%b8%80%e4%b8%aa%e5%ae%8c%e6%95%b4%e4%be%8b%e5%ad%90/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9924</guid>
		<description><![CDATA[                                                SAS Logistic回归:代码及输出报告详解
这篇将作为五一后一个讲稿的阅读材料之一，先整出来就搁这。如果没有耐心读下去，你可以立即转到以下的参考资料，该篇所有的知识都来自它们：

Cody, R.F. and Smith, J.K. Applied Statistics and the SAS Programming Language,4th ed..NJ:  Prentice-Hall,1997.这书已经出第五版了，北大图书馆只有这第四版。非常容易上手的一本书，前半部分用input和datalines让读者专心做统计，后半部分从导入导出数据开始阐述SAS的通用编程语言。这本书用的是SAS8.这里我们只关注它第九章Multiple-Regression Analysis的最后Logistic Regression部分。我这篇的例子即来于此，有简化；  
SAS OnlineDoc V8, 或者SAS OnlineDoc V9, 是要花功夫熟悉它们的结构了。以前我四处下载了数G的电子书，现在才发觉还是它们好使。体例上V8和V9一样，你找到SAS/STAT&#8211;&#62;SAS/STAT User&#8217;s Guide&#8211;&#62;The LOGISTIC Procedure, 就可以跟着学习了，文字都非常简明。

Logistic回归处理因变量是分类型变量如“0、1”的情形。一下就假设你至少对它模模糊糊有些印象，比如说我们用p表示正例（如输出变量为“1”）的概率，那么p/(1-p)就被称作odds ratio，对p做logit变换记做logit(p),它等于log(p/(1-p),我们回归方程的形式就如logit(p)=log(p/(1-p)=a+bx,你可以把它理解成向量形式。 
假设我们有一个数据，45个观测值，四个变量，包括：

age（年龄，数值型）；  
vision（视力状况，分类型，1表示好，0表示有问题）；  
drive（驾车教育，分类型，1表示参加过驾车教育，0表示没有） 和  
一个分类型输出变量accident（去年是否出过事故，1表示出过事故，0表示没有）。我们的目的就是要考察前三个变量与发生事故的关系。

为了保持程序的可读性，以下我就直接在代码中一行一行敲入数据，在实际工作中，超过20个观测值的数据就要写程序导入了。另外，/*   */之间的语句都是注释，SAS运行时会把它们忽略掉： 
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-

/* 
前三行，首先data步，建立一个叫logistic的临时数据集，它在work临时文件夹里。一般推荐用记事本把程序保存起来；input语句表示一下是几个变量；从datalines开始就一行一行输入数据，每个单独的数据之间用空格隔开，每个观测值各占一行。需要注意的是，datalines和下面的数据之间不要有空行，否则SAS会认为出现了一个缺失值。数据输入完毕，以分号结束，这个分号一定要另起一行。 
*/ 
data logistic;    input accident age vision drive;datalines;1 17 1 11 44 [...]]]></description>
			<content:encoded><![CDATA[<h4>                                                SAS Logistic回归:代码及输出报告详解</h4>
<p>这篇将作为五一后一个讲稿的阅读材料之一，先整出来就搁这。如果没有耐心读下去，你可以立即转到以下的参考资料，该篇所有的知识都来自它们：
<ol>
<li>Cody, R.F. and Smith, J.K. <strong></strong><a href="http://www.amazon.com/Applied-Statistics-SAS-Programming-Language/dp/0137436424" target="_blank">Applied Statistics and the SAS Programming Language,4th</a> ed..NJ:  Prentice-Hall,1997.这书已经出<a href="http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&amp;pc=60576" target="_blank">第五版</a>了，北大图书馆只有这第四版。非常容易上手的一本书，前半部分用input和datalines让读者专心做统计，后半部分从导入导出数据开始阐述SAS的通用编程语言。这本书用的是SAS8.这里我们只关注它第九章Multiple-Regression Analysis的最后Logistic Regression部分。我这篇的例子即来于此，有简化；  </li>
<li><a href="http://v8doc.sas.com/sashtml/" target="_blank">SAS OnlineDoc V8</a>, 或者<a href="http://support.sas.com/onlinedoc/913/docMainpage.jsp" target="_blank">SAS OnlineDoc V9</a>, 是要花功夫熟悉它们的结构了。以前我四处下载了数G的电子书，现在才发觉还是它们好使。体例上V8和V9一样，你找到SAS/STAT&#8211;&gt;<i>SAS/STAT User&#8217;s Guide</i>&#8211;&gt;The LOGISTIC Procedure, 就可以跟着学习了，文字都非常简明。</li>
</ol>
<p>Logistic回归处理因变量是分类型变量如“0、1”的情形。一下就假设你至少对它模模糊糊有些印象，比如说我们用p表示正例（如输出变量为“1”）的概率，那么p/(1-p)就被称作odds ratio，对p做logit变换记做logit(p),它等于log(p/(1-p),我们回归方程的形式就如logit(p)=log(p/(1-p)=a+bx,你可以把它理解成向量形式。 </p>
<p>假设我们有一个数据，45个观测值，四个变量，包括：
<ol>
<li>age（年龄，数值型）；  </li>
<li>vision（视力状况，分类型，1表示好，0表示有问题）；  </li>
<li>drive（驾车教育，分类型，1表示参加过驾车教育，0表示没有） 和  </li>
<li>一个分类型输出变量accident（去年是否出过事故，1表示出过事故，0表示没有）。我们的目的就是要考察前三个变量与发生事故的关系。</li>
</ol>
<p>为了保持程序的可读性，以下我就直接在代码中一行一行敲入数据，在实际工作中，超过20个观测值的数据就要写程序导入了。另外，/*   */之间的语句都是注释，SAS运行时会把它们忽略掉： </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<blockquote>
<p>/* </p>
<p>前三行，首先data步，建立一个叫logistic的临时数据集，它在work临时文件夹里。一般推荐用记事本把程序保存起来；input语句表示一下是几个变量；从datalines开始就一行一行输入数据，每个单独的数据之间用空格隔开，每个观测值各占一行。需要注意的是，datalines和下面的数据之间不要有空行，否则SAS会认为出现了一个缺失值。数据输入完毕，以分号结束，这个分号一定要另起一行。 </p>
<p>*/ </p>
<p><strong>data</strong> <em>logistic</em>;<br />   <strong> input</strong> <em>accident age vision drive</em>;<br /><strong>datalines</strong>;<br />1 17 1 1<br />1 44 0 0<br />1 48 1 0<br />1 55 0 0<br />1 75 1 1<br />0 35 0 1<br />0 42 1 1<br />0 57 0 0<br />0 28 0 1<br />0 20 0 1<br />0 38 1 0<br />0 45 0 1<br />0 47 1 1<br />0 52 0 0<br />0 55 0 1<br />1 68 1 0<br />1 18 1 0<br />1 68 0 0<br />1 48 1 1<br />1 17 0 0<br />1 70 1 1<br />1 72 1 0<br />1 35 0 1<br />1 19 1 0<br />1 62 1 0<br />0 39 1 1<br />0 40 1 1<br />0 55 0 0<br />0 68 0 1<br />0 25 1 0<br />0 17 0 0<br />0 45 0 1<br />0 44 0 1<br />0 67 0 0<br />0 55 0 1<br />1 61 1 0<br />1 19 1 0<br />1 69 0 0<br />1 23 1 1<br />1 19 0 0<br />1 72 1 1<br />1 74 1 0<br />1 31 0 1<br />1 16 1 0<br />1 61 1 0<br />;  </p>
<p>/* </p>
<p>以下两行我们不妨称作过程步甲。过程步以proc开头，加上要实现功能的名字，这里是logistics，接下来是要引用的数据。值得注意的是那个desending选项。SAS的Logistic回归方程log(odds)默认的形式是处理那个变量值比较小的，这里是accident=0，但我们要考察的是发生事故accident=1的情况，加上desending降序排列，它就处理accident=1的log(odds)了。再model引导的就是回归方程的形式，写成“因变量=自变量1    自变量2   自变量3”的样子。最后以run结束语句，与proc对应。 </p>
<p>*/ </p>
<p><strong>proc</strong> <strong>logistic</strong> data=logistic <em><font color="#ff0000">descending</font></em>;<br />     <strong>model </strong>accident=age vision drive; <strong>run</strong>; </p>
<p>/* </p>
<p>运行以上程序，就要跑出一大堆结果了。但在处理多元回归时，语句很难得会只像过程步甲一样简洁。以下过程步乙只加入一个变量选择选项forward。SAS在处理自变量选择上采用了5个技术，这里只简单提一下3个常用的技术。 </p>
<p>1.<font color="#ff0000">forward</font>——前向选择，变量一个个进入回归方程，按照一些卡方标准，最显著的也就是最好的变量最先进入，然后就是次最好的，以此类推。某个变量一旦进入，就不再退出； </p>
<p>2.<font color="#ff0000">backward</font>——后向剔除，一开始全部变量都进入回归方程，又按照一些标准，把最不好的变量一一剔除； </p>
<p>3.<font color="#ff0000">stepwise</font>——逐步回归，这个跟forward有些类似，不同的是，stepwise在变量进入以后还有一个backward后向剔除的过程，而在forward里，变量一旦进入，就不再退出。 </p>
<p>*/  </p>
<p><strong>proc</strong> <strong>logistic</strong> data=logistic descending;<br />   model accident=age vision drive  <font color="#ff0000">/<br /></font><strong>                selection</strong>=<em><font color="#ff0000">forward</font></em>;run; </p>
</blockquote>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-  </p>
<p>用上面这个过程步乙替代过程步甲，再运行一遍。这两个过程步的输出结果大同小异，只是过程步乙多了个forward选项。以下用的是过程步乙的输出结果，其中黑体字是输出结果本身，我做的注释语句以红笔描出,包括数字编号。   </p>
<p>                <font color="#ff0000"> (<font color="#ff0000">1</font>)</font>  The SAS System 10:47 Tuesday, May 4, 2007 1  </p>
<p>                             The LOGISTIC Procedure  </p>
<p>                               Model Information  </p>
<p>Data Set                                         WORK.LOGISTIC<br />Response Variable                          accident<br />Number of Response Levels            2<br />Number of Observations                 45<br />Model                                              binary logit<br />Optimization Technique                 Fisher&#8217;s scoring  </p>
<p>   </p>
<p>                             <font color="#ff0000">Response Profile</font>                                     <br />Ordered  Value     accident          Total Frequency  </p>
<p>       1                        1                             25<br />       2                        0                             20  </p>
<p>Probability modeled<br />
is accident=1.  </p>
<p><font color="#ff0000">(1) </font>给出了本模型的基本信息，意思大多自明。需要注意的是<font color="#400040">Response Profile</font> 中，accident=1排在首位。前面我们说过，SAS的Logistic回归方程log(odds)默认的形式是处理那个变量值比较小的，加上descending选项后，accident=1就排在首位了。 </p>
<p>                      <font color="#ff0000">(2) </font>  Forward Selection Procedure  </p>
<p>Step 0. Intercept entered:  </p>
<p>                          Model Convergence Status  </p>
<p>Convergence criterion (GCONV=1E-8) satisfied.  </p>
<p>                          Residual Chi-Square Test  </p>
<p>Chi-Square              DF                Pr &gt; ChiSq  </p>
<p>  10.7057                   3                     0.0134  </p>
<p>   </p>
<p><font color="#ff0000">Step 1</font>. Effect <font color="#ff0000">vision </font>entered:  </p>
<p>                              Model Convergence Status  </p>
<p>Convergence criterion (GCONV=1E-8) satisfied. <br />                               Model Fit Statistics                                               <br /> Criterion     Intercept Only     Intercept and Covariates<br /><strong>AIC</strong>                 63.827                   <strong>59.244</strong><br /><strong>SC</strong>                   65.633                   <strong>62.857</strong><br /><font color="#ff0000">-2 Log L</font>           61.827                  55.244 </p>
<p>                       Testing Global Null Hypothesis: BETA=0<br />Test                       Chi-Square    DF    Pr &gt; ChiSq<br /><font color="#ff0000">Likelihood Ratio</font>      6.5830         1         <font color="#ff0000">0.0103</font><br /><font color="#ff0000">Score</font>                       6.4209         1         <font color="#ff0000">0.0113</font><br />Wald                        6.0756         1         0.0137 </p>
<p>                       Residual Chi-Square Test<br />Chi-Square            DF      Pr &gt; ChiSq<br />      4.9818              2         0.0828 </p>
<p><font color="#ff0000">Step 2</font>. Effect <font color="#ff0000">drive</font> entered:<br />                     Model Convergence Status<br />                  Convergence criterion (GCONV=1E-8) satisfied.                        </p>
<p>                         Model Fit Statistics<br />Criterion      Intercept Only     Intercept and Covariates<br />AIC                  63.827                     <strong>56.287</strong><br /><strong>SC</strong>                   65.633                     <strong>61.707<br /></strong><font color="#ff0000">-2 Log L</font>           61.827                     50.287 </p>
<p>  </p>
<p>                 Testing Global Null Hypothesis: BETA=0<br />Test                        Chi-Square     DF   Pr &gt; ChiSq<br /><font color="#ff0000">Likelihood Ratio</font>         11.5391        2      <font color="#ff0000">0.0031</font><br /><font color="#ff0000">Score</font>                          10.5976        2      <font color="#ff0000">0.0050</font><br />Wald                            8.5949         2      0.0136<br />               </p>
<p>                 Residual Chi-Square Test<br />Chi-Square     DF   Pr &gt; ChiSq<br />     0.1293        1     0.7191 </p>
<p>NOTE: No (additional) effects met the 0.05 significance level for entry into the model. </p>
<p><font color="#ff0000">(2) </font>给出了自变量进入模型的次序。先是截距项Step 0了，不管它。<font color="#ff0000">Step 1 </font>vision第一个进入模型，附带了很多评估它对因变量预测能力的指标。<font color="#ff0000">-2 Log L</font> 和<font color="#ff0000">Score</font> 用来检测自变量是否显著。<font color="#ff0000">-2 Log L</font>中的L就是Likelihood Ratio，它的p值是<font color="#ff0000">0.0103</font>，<font color="#ff0000">Score</font>  的p值是<font color="#ff0000">0.0113</font>，都小于0.05，故vision是一个很显著的解释变量。还有，<strong>AIC</strong>(Akaike Information Criterion)和<strong>SC</strong>(Schwarz Criterion)两个信息量标准用来比较不同的模型，它们数值越小，模型变现就越好，这个接下来我们看<font color="#ff0000">step2 drive</font>变量进入模型后的情况。 我们可以看到模型的表现变好了，因为这是<strong>AIC</strong>和<strong>SC</strong>的值变小了，<font color="#ff0000">-2 Log L</font> 和<font color="#ff0000">Score</font><font color="#400040">对应的</font>p值也更小。 </p>
<p>                <font color="#ff0000">(3) </font>  Summary of Forward Selection<br />Step    Effect Entered        DF      Number In      Score Chi-Square        Pr &gt; ChiSq<br />1            vision                    1           1                      6.4209                        0.0113<br />2            drive                     1            2                     4.8680                         0.0274 </p>
<p> <font color="#ff0000">(3) </font>总结了我们模型使用的前向选择方法，包括自变量进入模型的次序，以及每个自变量的卡方值和p值。 </p>
<p>                    <font color="#ff0000">(4) </font>Analysis of Maximum Likelihood Estimates<br />Parameter   DF   Estimate    Standard Error  Wald Chi-Square   Pr &gt; ChiSq<br />Intercept     1      <font color="#ff0000">0.1110</font>               0.5457           0.0414                 0.8389<br />vision           1      <font color="#ff0000">1.7137</font>               0.7049           5.9113                 0.0150<br />drive            1     <font color="#ff0000">-1.5000</font>               0.7037           4.5440                 0.0330 </p>
<p><font color="#ff0000">(4) </font><font color="#400040">给出了模型参数的估计，据此可以写出改回归方程的形式是log(odds of having an accident)=log(p/(1-p))=0.1110+1.7137*vision-1.5000*drive。我们知道，odds=p/(1-p),有p=odds/(1+odds)。假设有个哥们，视力没问题但没有受过驾车教育（vision=0,drive=0），代入方程，有log(odds)=0.1110，再odds=exp(0.110)=<font color="#ff0000">1.1174</font>，p=1.1174/2.1174=0.5277，即我们说这人发生事故的概率为0.5277；又另一个，视力有问题同样没受过驾车教育（vision=1,drive=0），同样的步骤得</font>log(odds)=1.8249，odds=exp(1.8249)=<font color="#ff0000">6.2022</font>，p=6.2022/7.2022=0.8612，即这人发生事故的概率为0.8612（视力多重要）。 </p>
<p>                 <font color="#ff0000">(5) </font><font color="#ff0000"> </font>Odds Ratio Estimates<br />Effect       Point Estimate               95% Wald Confidence Limits<br /><font color="#ff0000">vision</font>           <font color="#ff0000"> 5.550<br />
</font>                               1.394           22.093<br />drive             0.223                               0.056            0.886 </p>
<p> <font color="#ff0000">(5) </font>是对比率Odds Ratio的估计。这里对vision的odds ratio的点估是<font color="#ff0000"> 5.550</font> ，这个比率由odds(having an accident|vision=1,drive=0)比odds(having an accident|vision=0,drive=0)得来，根据<font color="#ff0000">(4) </font>的计算，就是<font color="#ff0000">6.2022</font><font color="#000000">/</font><font color="#ff0000">1.1174=<font color="#ff0000">5.550</font></font><font color="#400040">.还有，对vision来说，95% 的置信区间不包括1，说明vision是一个非常显著的解释变量（比率的置信区间不包括1，就跟p值小于0.05一样是一个规则）。</font> </p>
<p>                 <font color="#ff0000">(6) </font>Association of Predicted Probabilities and Observed Responses<br /><font color="#ff0000">Percent Concordant</font>             67.2               Somers&#8217; D 0.532<br /><font color="#ff0000">Percent Discordant</font>              14.0               Gamma 0.655<br />Percent Tied                        18.8                Tau-a 0.269<br />Pairs                                     500                  c 0.766 </p>
<p><font color="#ff0000">(6) </font>这个东西就有些复杂,大概说些预测概率与观测道德因变量间的关联性，我们看到一致性比率Percent Concordant 为67.2 %，不一致性比率Percent Discordant 为14.0%，说明预测值与观测值在现有水平上有较强的关联性,回归模型有很强的预测能力。 </p>
<p>最后注意到，上面我们用过程步乙得出的输出结果没有age这个自变量，用过程步甲得出的输出有，这不是因为年龄在这个预测模型中不重要，而是上面以数值型面目出现的年龄在是否出现事故的两组人中分布不均匀，为了解决这个问题，把年龄分组就是，不多说了。 </p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/05/04/sas-logistic%e5%9b%9e%e5%bd%92%ef%bc%9a%e4%b8%80%e4%b8%aa%e5%ae%8c%e6%95%b4%e4%be%8b%e5%ad%90/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>一组常用的SAS快捷键和命令（一）：入门阶段</title>
		<link>http://www.jiangtanghu.com/cn/2007/04/03/%e4%b8%80%e7%bb%84%e5%b8%b8%e7%94%a8%e7%9a%84sas%e5%bf%ab%e6%8d%b7%e9%94%ae%e5%92%8c%e5%91%bd%e4%bb%a4%ef%bc%88%e4%b8%80%ef%bc%89%ef%bc%9a%e5%85%a5%e9%97%a8%e9%98%b6%e6%ae%b5/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/04/03/%e4%b8%80%e7%bb%84%e5%b8%b8%e7%94%a8%e7%9a%84sas%e5%bf%ab%e6%8d%b7%e9%94%ae%e5%92%8c%e5%91%bd%e4%bb%a4%ef%bc%88%e4%b8%80%ef%bc%89%ef%bc%9a%e5%85%a5%e9%97%a8%e9%98%b6%e6%ae%b5/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9920</guid>
		<description><![CDATA[腾出手来动鼠标，对习惯在Linux下编程的程序员来说都非常麻烦：双手最好都时刻停在键盘上。在SAS for Windows下，还是有几个快捷键能让我们的工作更轻松，一下都是都是我平时常用的，而且大多每次开机都要用上：

第一个当然是F9，它能显示所有的SAS快捷键；一个可以替代的SAS 命令栏命令是keys。这个命令栏就是SAS 视窗左上角那个小框，在菜单栏下面那个，不是SAS的程序编辑器Editor；  
提到命令框，第2个快捷键就是F11。比如说你在Editor下写程序，想要显示每条程序的行号，摁下F11就可以跳到命令框，敲入nums，回车，就回到你当前的编辑器里；  
当然你还可以在程序编辑器Editor里加一个命令框：Tools——Options——Preferences——View，找到Command line钩上就是。这样在你的Editor上面就会出现一个Command ===&#62;,这里你可以像在命令框一样敲入一些小命令，比如bye就退出系统。对这个Command line，一个类似命令框的F11的快捷键是home，它可以在Command line和Editor之间来回切换。比较一下，命令框的好处就是它能自动记下你敲入的每条命令，以后你敲入一个字母它就能够自动补齐，Command line没有记忆功能，它的好处就是，它就在你的编辑器里；  
返回键backspace：比如说你在Libraries一路点开，backspace可以一路返回；  
接下来是一组连贯的快捷键（F3到F7）：

F5回到你的程序编辑器Editor；  
写好程序后，摁F3提交运行；  
F6查看Log；  
F7查看结果Output；  
如果你在编辑器里删了些东西，F4可以追回整段的代码（recall）。   


一些组合键可以在第二阶段再熟悉，但一些在Windows下通用的快捷键还是很有价值，如home回到一行的开始，end回到一行的末尾，Ctrl+Home回到整篇的开始，Ctrl+end回到整篇的末尾，摁下Shift不方再用上下左右键选中你感兴趣的内容。

总结一下，这里介绍了：

F9, keys  
F11, nums, bye; home (for Command line)  
backspace  
F5, F3, F6, F7, F4  
home, end, Ctrl+Home, Ctrl+end, Shift+上下左右键

]]></description>
			<content:encoded><![CDATA[<p>腾出手来动鼠标，对习惯在Linux下编程的程序员来说都非常麻烦：双手最好都时刻停在键盘上。在SAS for Windows下，还是有几个快捷键能让我们的工作更轻松，一下都是都是我平时常用的，而且大多每次开机都要用上：</p>
<ol>
<li>第一个当然是F9，它能显示所有的SAS快捷键；一个可以替代的SAS 命令栏命令是keys。这个命令栏就是SAS 视窗左上角那个小框，在菜单栏下面那个，不是SAS的程序编辑器Editor；  </li>
<li>提到命令框，第2个快捷键就是F11。比如说你在Editor下写程序，想要显示每条程序的行号，摁下F11就可以跳到命令框，敲入nums，回车，就回到你当前的编辑器里；  </li>
<li>当然你还可以在程序编辑器Editor里加一个命令框：Tools——Options——Preferences——View，找到Command line钩上就是。这样在你的Editor上面就会出现一个Command ===&gt;,这里你可以像在命令框一样敲入一些小命令，比如bye就退出系统。对这个Command line，一个类似命令框的F11的快捷键是home，它可以在Command line和Editor之间来回切换。比较一下，命令框的好处就是它能自动记下你敲入的每条命令，以后你敲入一个字母它就能够自动补齐，Command line没有记忆功能，它的好处就是，它就在你的编辑器里；  </li>
<li>返回键backspace：比如说你在Libraries一路点开，backspace可以一路返回；  </li>
<li>接下来是一组连贯的快捷键（F3到F7）：
<ul>
<li>F5回到你的程序编辑器Editor；  </li>
<li>写好程序后，摁F3提交运行；  </li>
<li>F6查看Log；  </li>
<li>F7查看结果Output；  </li>
<li>如果你在编辑器里删了些东西，F4可以追回整段的代码（recall）。   </li>
</ul>
</li>
<li>一些组合键可以在第二阶段再熟悉，但一些在Windows下通用的快捷键还是很有价值，如home回到一行的开始，end回到一行的末尾，Ctrl+Home回到整篇的开始，Ctrl+end回到整篇的末尾，摁下Shift不方再用上下左右键选中你感兴趣的内容。</li>
</ol>
<p>总结一下，这里介绍了：</p>
<ul>
<li>F9, keys  </li>
<li>F11, nums, bye; home (for Command line)  </li>
<li>backspace  </li>
<li>F5, F3, F6, F7, F4  </li>
<li>home, end, Ctrl+Home, Ctrl+end, Shift+上下左右键</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/04/03/%e4%b8%80%e7%bb%84%e5%b8%b8%e7%94%a8%e7%9a%84sas%e5%bf%ab%e6%8d%b7%e9%94%ae%e5%92%8c%e5%91%bd%e4%bb%a4%ef%bc%88%e4%b8%80%ef%bc%89%ef%bc%9a%e5%85%a5%e9%97%a8%e9%98%b6%e6%ae%b5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>推荐书：朱世武老师的《SAS编程技术与金融数据处理》</title>
		<link>http://www.jiangtanghu.com/cn/2007/03/26/%e6%8e%a8%e8%8d%90%e4%b9%a6%ef%bc%9a%e6%9c%b1%e4%b8%96%e6%ad%a6%e8%80%81%e5%b8%88%e7%9a%84%e3%80%8asas%e7%bc%96%e7%a8%8b%e6%8a%80%e6%9c%af%e4%b8%8e%e9%87%91%e8%9e%8d%e6%95%b0%e6%8d%ae%e5%a4%84/</link>
		<comments>http://www.jiangtanghu.com/cn/2007/03/26/%e6%8e%a8%e8%8d%90%e4%b9%a6%ef%bc%9a%e6%9c%b1%e4%b8%96%e6%ad%a6%e8%80%81%e5%b8%88%e7%9a%84%e3%80%8asas%e7%bc%96%e7%a8%8b%e6%8a%80%e6%9c%af%e4%b8%8e%e9%87%91%e8%9e%8d%e6%95%b0%e6%8d%ae%e5%a4%84/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>胡江堂</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.jiangtanghu.com/cn/?p=9917</guid>
		<description><![CDATA[ 给同学们推荐朱世武的《SAS编程技术与金融数据处理》  
我去年月底订的这本书，就一直用这本书学SAS和金融数据分析了。以下我就从个人角度说说我为什么要买这本书（我从学校图书馆借了几本有关SAS的书，而且电脑里已经存了上G的电子书——现在是越来越难得买纸书了）。首先一个问题是： 
1.我为什么要学SAS？ 
我念的专业是金融信息工程。上个学期选的一门课叫《信用卡业务与系统》，老师多有强调SAS在信用评分模型开发方面的作用——他说在这个领域，SAS是唯一的语言。的确，在金融数据分析这个行业，SAS软件是无可动摇的老大。当然，SAS称雄的领域不止在我们金融行业，这本书的作者朱世武老师也说：“目前，在具有工业用途的三个统计分析软件SAS,S-Plus和SPSS中，SAS是最好的。”现在SAS认证是最具影响力的国际专业认证之一，在欧美等国家的职场上流行这样一句话:“如果拥有SAS认证，你将永远不会失去你的工作”(“If you have a SAS certification, You will never lose your job”)。当然，SAS不止是一个统计软件，它已经发展成为一个大型的商业智能（BI）平台。今年春季学期我要选的两门数据仓库和数据挖掘课程，SAS的一个组件Enterprise Miner是最流行的数据挖掘工具之一，和IBM的DB2 Intelligent Miner、微软的Microsoft SQL Server 2005 Data Mining以及SPSS Clementine等齐名，而且SAS公司一直是数据仓库的引导者。这扯远了，主要说说第二个问题：  
2.我为什么要买这本书?  
现在市场上不乏SAS的教科书,我觉得朱老师这本书的好处是（在买之前就多方比较啦）：  
1）它是目前唯一本以金融数据为导向的SAS入门与提高型中文教材。这本书中的数据全部来自真实的金融业务，在学习时能有意无意培养我们对金融数据的敏感；最后两章还提供了金融资产收益和固定收入证券的SAS建模与计算；另外，这本书还详细介绍了SAS与当前通用的金融数据库如Reuter的使用接口。我一位在上海教统计的朋友说过：学SAS，金融首选朱世武。说的就是这本（朱老师还有一本高级教程《基于SAS系统的金融计算》，可以看作本书的后续教程）；  
2）它强调SAS编程而不仅仅是一般的SAS统计计算。市面上的SAS教科书——据我在我们北大图书馆和中关村几家书店翻书得来的观察，几乎都是从统计方面介绍SAS的应用，只有一个台湾作者王惠群写的一本叫《SAS程序设计》（这书我借过，公开场合，与人为善，我不发表评论，只是我没有买它就是）。从统计角度写SAS，好处就是上手快，照着几个模版就能用，但是不能培养良好的编程习惯，不能够举一反三。除了统计分析，这本书更多的强调SAS语言的数据访问、管理、展现以及应用开发等功能——这些才是SAS语言编程的基础，数据统计分析只是一个应用而已，学了基础很容易掌握。前面说过，SAS是一套大型的商业智能系统，它的功能不仅仅是统计分析（当然，SAS是靠统计分析起家）；  
3）最后一个不回答我为什要买这本书，而是要说买之后很庆幸没买错。本书的随书光盘提供了本书的全部应用数据和相关程序。上机调试，修改几处明显的文字错误，都一一可行。完整的数据还有实际可行的程序，对初学者培养信心影响很大。  
当然，最后还有一个问题：为什么要买书，买纸书？SAS的电子文档有很多，可以说是太多啦。很多SAS初学者（像我一开始）容易犯的一个错误就是四处在网上搜罗各种电子文档，觉得所有的教程存在电脑才踏实，可就是没用多少时间认认真真在键盘上敲程序。一本好的入门书，就像这本，除了可以随时备查，还可以让你安静下来，坐在机器前实实在在学些东西， 基础有了，看各种电子文档就轻松了。在SAS中国的主页上，就特别推荐了朱老师这本书。
]]></description>
			<content:encoded><![CDATA[<p> 给同学们推荐朱世武的《SAS编程技术与金融数据处理》  </p>
<p>我去年月底订的这本书，就一直用这本书学SAS和金融数据分析了。以下我就从个人角度说说我为什么要买这本书（我从学校图书馆借了几本有关SAS的书，而且电脑里已经存了上G的电子书——现在是越来越难得买纸书了）。首先一个问题是： </p>
<p>1.我为什么要学SAS？ </p>
<p>我念的专业是金融信息工程。上个学期选的一门课叫《信用卡业务与系统》，老师多有强调SAS在信用评分模型开发方面的作用——他说在这个领域，SAS是唯一的语言。的确，在金融数据分析这个行业，SAS软件是无可动摇的老大。当然，SAS称雄的领域不止在我们金融行业，这本书的作者朱世武老师也说：“目前，在具有工业用途的三个统计分析软件SAS,S-Plus和SPSS中，SAS是最好的。”现在SAS认证是最具影响力的国际专业认证之一，在欧美等国家的职场上流行这样一句话:“如果拥有SAS认证，你将永远不会失去你的工作”(“If you have a SAS certification, You will never lose your job”)。<br />当然，SAS不止是一个统计软件，它已经发展成为一个大型的商业智能（BI）平台。今年春季学期我要选的两门数据仓库和数据挖掘课程，SAS的一个组件Enterprise Miner是最流行的数据挖掘工具之一，和IBM的DB2 Intelligent Miner、微软的Microsoft SQL Server 2005 Data Mining以及SPSS Clementine等齐名，而且SAS公司一直是数据仓库的引导者。这扯远了，主要说说第二个问题：  </p>
<p>2.我为什么要买这本书?  </p>
<p>现在市场上不乏SAS的教科书,我觉得朱老师这本书的好处是（在买之前就多方比较啦）：  </p>
<p>1）它是目前唯一本以金融数据为导向的SAS入门与提高型中文教材。这本书中的数据全部来自真实的金融业务，在学习时能有意无意培养我们对金融数据的敏感；最后两章还提供了金融资产收益和固定收入证券的SAS建模与计算；另外，这本书还详细介绍了SAS与当前通用的金融数据库如Reuter的使用接口。我一位在上海教统计的朋友说过：学SAS，金融首选朱世武。说的就是这本（朱老师还有一本高级教程《基于SAS系统的金融计算》，可以看作本书的后续教程）；  </p>
<p>2）它强调SAS编程而不仅仅是一般的SAS统计计算。市面上的SAS教科书——据我在我们北大图书馆和中关村几家书店翻书得来的观察，几乎都是从统计方面介绍SAS的应用，只有一个台湾作者王惠群写的一本叫《SAS程序设计》（这书我借过，公开场合，与人为善，我不发表评论，只是我没有买它就是）。从统计角度写SAS，好处就是上手快，照着几个模版就能用，但是不能培养良好的编程习惯，不能够举一反三。除了统计分析，这本书更多的强调SAS语言的数据访问、管理、展现以及应用开发等功能——这些才是SAS语言编程的基础，数据统计分析只是一个应用而已，学了基础很容易掌握。前面说过，SAS是一套大型的商业智能系统，它的功能不仅仅是统计分析（当然，SAS是靠统计分析起家）；  </p>
<p>3）最后一个不回答我为什要买这本书，而是要说买之后很庆幸没买错。本书的随书光盘提供了本书的全部应用数据和相关程序。上机调试，修改几处明显的文字错误，都一一可行。完整的数据还有实际可行的程序，对初学者培养信心影响很大。  </p>
<p>当然，最后还有一个问题：为什么要买书，买纸书？SAS的电子文档有很多，可以说是太多啦。很多SAS初学者（像我一开始）容易犯的一个错误就是四处在网上搜罗各种电子文档，觉得所有的教程存在电脑才踏实，可就是没用多少时间认认真真在键盘上敲程序。一本好的入门书，就像这本，除了可以随时备查，还可以让你安静下来，坐在机器前实实在在学些东西， 基础有了，看各种电子文档就轻松了。在SAS中国的主页上，就特别推荐了朱老师这本书。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangtanghu.com/cn/2007/03/26/%e6%8e%a8%e8%8d%90%e4%b9%a6%ef%bc%9a%e6%9c%b1%e4%b8%96%e6%ad%a6%e8%80%81%e5%b8%88%e7%9a%84%e3%80%8asas%e7%bc%96%e7%a8%8b%e6%8a%80%e6%9c%af%e4%b8%8e%e9%87%91%e8%9e%8d%e6%95%b0%e6%8d%ae%e5%a4%84/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

