<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>A Blog on Analytics and Marketing</title>
	<atom:link href="http://phillippeng.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://phillippeng.wordpress.com</link>
	<description>SAS, Marketing, Predictive Modeling, Statistics</description>
	<lastBuildDate>Wed, 07 Oct 2009 16:20:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='phillippeng.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>A Blog on Analytics and Marketing</title>
		<link>http://phillippeng.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://phillippeng.wordpress.com/osd.xml" title="A Blog on Analytics and Marketing" />
	<atom:link rel='hub' href='http://phillippeng.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Deploy your excel macros from a central file</title>
		<link>http://phillippeng.wordpress.com/2009/10/07/deploy-your-excel-macros-from-a-central-file/</link>
		<comments>http://phillippeng.wordpress.com/2009/10/07/deploy-your-excel-macros-from-a-central-file/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 16:20:54 +0000</pubDate>
		<dc:creator>phillippeng</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[MS Office]]></category>
		<category><![CDATA[excel macro; MS Office]]></category>

		<guid isPermaLink="false">http://phillippeng.wordpress.com/?p=110</guid>
		<description><![CDATA[deploy your excel macros from a central file<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=110&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are some advantages of deploying your excel macros from a central file:</p>
<p>1. You can manage all your macros in one file. Especially, when you need to backup all your handy utility macros, it&#8217;s very convenient.<br />
2. You can activate all the macros when you start Excel every time.</p>
<p>It&#8217;s quite easy to do so. You just need to save all your macros in a file called personal.xls in the excel start folder. The path should look like<strong> &#8216;C:\Program Files\Microsoft Office\OFFICE11\XLSTART\&#8217;.</strong></p>
<p>Next time when you develop a new macro, save the macro in this personal.xls and your new macro will be added to this file.</p>
<br />Posted in Excel, MS Office Tagged: excel macro; MS Office <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phillippeng.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phillippeng.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phillippeng.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phillippeng.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phillippeng.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phillippeng.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phillippeng.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phillippeng.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phillippeng.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phillippeng.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phillippeng.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phillippeng.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phillippeng.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phillippeng.wordpress.com/110/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=110&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phillippeng.wordpress.com/2009/10/07/deploy-your-excel-macros-from-a-central-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f388fc20f86b84a6c400fed38e390fac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phillippeng</media:title>
		</media:content>
	</item>
		<item>
		<title>Ten Reasons Why Models May Fail</title>
		<link>http://phillippeng.wordpress.com/2009/09/14/ten-reasons-why-models-may-fail/</link>
		<comments>http://phillippeng.wordpress.com/2009/09/14/ten-reasons-why-models-may-fail/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 15:47:02 +0000</pubDate>
		<dc:creator>phillippeng</dc:creator>
				<category><![CDATA[Marketing]]></category>
		<category><![CDATA[Modeling]]></category>

		<guid isPermaLink="false">http://phillippeng.wordpress.com/?p=106</guid>
		<description><![CDATA[Ten Reasons Why Models May Fail<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=106&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Kent Leahy and Nethra Sambamoorthi list ten most common reasons why predictive models in marketing may fail. These top ten reasons are:</p>
<p>(1) Modeling strategy design. The person who will actually be building the model is not included in the initial discussions or design of the model.<br />
(2) Model overfitting. The model has been &#8220;overfit&#8221; to the sample at hand ,and, consequently, does not generalize well to the actual mailing population, or is otherwise unreliable.<br />
(3) Population shift due to environment changes. The circumstances surrounding the actual mailing change or the mailing environment turns out to be substantially different from the one on which the model was built.<br />
(4) Model generalization too much. The model is used as though it were &#8216;generic&#8217; or &#8216;universally applicable&#8217;.<br />
(5) Population shift and model overfitting. Changes in the mailing environment in conjunction with the use of an &#8216;overfitted&#8217; model.<br />
(6) Model out-of-date. The model contains &#8220;post-event&#8221; variable(s), or those that occurred after the event you are trying to predict.<br />
(7) Model validation and implementation. Not &#8216;test-scoring&#8217; the model, or making an error when implementing the model.<br />
(8) Sample selection QC. Failing to run an audit of the file as the first step in the model-building process.<br />
(9) Miss the model expectation. A consensus on just exactly what the model is expected to predict (and for which audience) is not reached and/or well understood.<br />
(10) Poor fanancial Planning. The model performs well but the mailing itself is not a financial &#8216;success&#8217;.</p>
<p>Reference: http://www.crmportals.com/crmnews/2002123.html</p>
<br />Posted in Marketing, Modeling  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phillippeng.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phillippeng.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phillippeng.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phillippeng.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phillippeng.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phillippeng.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phillippeng.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phillippeng.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phillippeng.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phillippeng.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phillippeng.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phillippeng.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phillippeng.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phillippeng.wordpress.com/106/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=106&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phillippeng.wordpress.com/2009/09/14/ten-reasons-why-models-may-fail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f388fc20f86b84a6c400fed38e390fac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phillippeng</media:title>
		</media:content>
	</item>
		<item>
		<title>Resources from SIAM</title>
		<link>http://phillippeng.wordpress.com/2009/09/10/resources-from-siam/</link>
		<comments>http://phillippeng.wordpress.com/2009/09/10/resources-from-siam/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 18:55:01 +0000</pubDate>
		<dc:creator>phillippeng</dc:creator>
				<category><![CDATA[Modeling]]></category>
		<category><![CDATA[data mining]]></category>

		<guid isPermaLink="false">http://phillippeng.wordpress.com/?p=100</guid>
		<description><![CDATA[SIAM, modeling resources<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=100&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>SIAM</strong> stands for <strong>Society for Industrial and Applied Mathematics</strong>. Invited and Prize Lectures from the 2008 and 2009 Annual Meetings are captured as slides with audio. You can access them through the following link:</p>
<p>http://live.blueskybroadcast.com/bsb/client/CL_DEFAULT.asp?Client=975312&amp;title=Home</p>
<p>The proceedings section includes good coverage on data mining:</p>
<p>http://www.siam.org/proceedings/</p>
<br />Posted in Modeling Tagged: data mining <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phillippeng.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phillippeng.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phillippeng.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phillippeng.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phillippeng.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phillippeng.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phillippeng.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phillippeng.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phillippeng.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phillippeng.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phillippeng.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phillippeng.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phillippeng.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phillippeng.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=100&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phillippeng.wordpress.com/2009/09/10/resources-from-siam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f388fc20f86b84a6c400fed38e390fac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phillippeng</media:title>
		</media:content>
	</item>
		<item>
		<title>Text Editor to Recommend: Notepad++</title>
		<link>http://phillippeng.wordpress.com/2009/09/03/text-editor-to-recommend-notepad/</link>
		<comments>http://phillippeng.wordpress.com/2009/09/03/text-editor-to-recommend-notepad/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 18:27:53 +0000</pubDate>
		<dc:creator>phillippeng</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[SAS]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://phillippeng.wordpress.com/?p=94</guid>
		<description><![CDATA[a free but powerful text editor tool, Notepad++<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=94&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As I search for a free but powerful text editor tool, Notepad++ just comes on top of the list. Notepad++ is widely used by advanced programmers.</p>
<p>Download Page: <a title="Notepad++ download Page" href="http://download.cnet.com/Notepad/3000-2352_4-10327521.html" target="_blank"> http://download.cnet.com/Notepad/3000-2352_4-10327521.html </a></p>
<p>Great resource Link:  <a href="http://notepad-plus.sourceforge.net/uk/download.php" target="_blank">http://notepad-plus.sourceforge.net/uk/download.php</a></p>
<p>Notepad++ has built in formatting modules for many programming languages. However, SAS is not one of them.  You can add SAS as a user-defined language following steps below:</p>
<p>1. Download the user-defined language to your computer<br />
2. Click start, run, type (or paste in) %APPDATA%\Notepad++ then click ok<br />
3. Rename userDefineLang_SAS.xml as userDefineLang.xml<br />
4. Copy and paste userDefineLang.xml file into the directory. If you add more than one languages, simply<br />
copy everything from each file starting at &lt;UserLang&#8230;&gt; to &lt;/UserLang&gt; and paste it at the end of the userDefineLang.xml<br />
right before &lt;/NotepadPlus&gt;.<br />
5. Save the newly improved userDefineLang.xml</p>
<p>SAS language formatting file was originally created by <strong><a href="writeTo('','');"><strong>Joakim</strong></a></strong><strong><strong> </strong></strong>and can be downloaded from <a title="SAS" href="http://notepad-plus.sourceforge.net/commun/userDefinedLang/userDefineLang_sas.xml" target="_self">SAS</a><strong><strong>.</strong></strong> I have made some changes to this file. If you have interests in it, please email me (ppeng08@gmail.com).</p>
<p>I&#8217;d like to call out some great features about Notepad++:</p>
<p>1. Highlighting your coding language;<br />
2. Column selection and edition;<br />
method: click the starting position &#8211;&gt; alt+shift+click the ending position<br />
You can then edit by column. It works great.<br />
Column edit (alt+C) from the menu does not work the way I want.<br />
3. Able to open an incomplete file. For example, you want to check the SAS log file while you code is still running. Regular text editor just cannot open such a file. Notepad++ can read whatever in the current file. Once there are more information added to the file, a window will pop-up asking if you want to reload/refresh the file in the window.<br />
4. Advanced search and replace. When you search for one word, the same word in the whole file will be highlighted. This helps check your spelling and the keyword referencing in the file.</p>
<p>&#8230;&#8230;&#8230;&#8230;</p>
<p>You will find more great features as you begin to use it.</p>
<p><strong><strong><br />
</strong></strong></p>
<br />Posted in Computer, SAS, SQL  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phillippeng.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phillippeng.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phillippeng.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phillippeng.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phillippeng.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phillippeng.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phillippeng.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phillippeng.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phillippeng.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phillippeng.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phillippeng.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phillippeng.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phillippeng.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phillippeng.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=94&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phillippeng.wordpress.com/2009/09/03/text-editor-to-recommend-notepad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f388fc20f86b84a6c400fed38e390fac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phillippeng</media:title>
		</media:content>
	</item>
		<item>
		<title>How To Select All Columns Except One Column From A Table?</title>
		<link>http://phillippeng.wordpress.com/2009/07/31/how-to-select-all-columns-except-one-column-from-a-table/</link>
		<comments>http://phillippeng.wordpress.com/2009/07/31/how-to-select-all-columns-except-one-column-from-a-table/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 20:32:44 +0000</pubDate>
		<dc:creator>phillippeng</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[column selection]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://phillippeng.wordpress.com/?p=89</guid>
		<description><![CDATA[Select All Columns Except One Column From A Table<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=89&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you have a table with more than ten columns and you need to select all columns except one column, you may not want to type the column names one by one. Especially, it becomes very challenging if you have too many columns. Here&#8217;s my trick to do this.</p>
<p>1. Select all columns into another table and drop the column you don&#8217;t want.<br />
select * into #temp from table_a<br />
alter table #temp<br />
drop column col1              (col1 is the column that you don&#8217; t want to select.)</p>
<p>2. Rename the column and then drop.<br />
When you want to join two tables by matching the ID column in each table, you want to use &#8216;select * from table_a, table_b by a.id = b.id&#8217;. However, an error message will tell you to select only a.id or b.id. It comes back to our old question. But we cannot drop the ID column first because we need to keep it for the Join purpose. The easy answer is to rename the column and then drop it.<br />
sp_rename &#8216;Table_a.ID&#8217;, &#8216;ID_a&#8217;, &#8216;Column&#8217;</p>
<br />Posted in SQL Tagged: column selection, join, SQL Server <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phillippeng.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phillippeng.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phillippeng.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phillippeng.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phillippeng.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phillippeng.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phillippeng.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phillippeng.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phillippeng.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phillippeng.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phillippeng.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phillippeng.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phillippeng.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phillippeng.wordpress.com/89/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=89&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phillippeng.wordpress.com/2009/07/31/how-to-select-all-columns-except-one-column-from-a-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f388fc20f86b84a6c400fed38e390fac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phillippeng</media:title>
		</media:content>
	</item>
		<item>
		<title>SAS: Verify function to check invalid data</title>
		<link>http://phillippeng.wordpress.com/2009/07/29/sas-verify-function-to-check-invalid-data/</link>
		<comments>http://phillippeng.wordpress.com/2009/07/29/sas-verify-function-to-check-invalid-data/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 15:35:27 +0000</pubDate>
		<dc:creator>phillippeng</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://phillippeng.wordpress.com/?p=85</guid>
		<description><![CDATA[Use Verify function to check invalid data in SAS<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=85&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Syntax for verify function:<br />
verify(character_variable, verify_string)</p>
<p>The verify function returns the first position in the character_variable that contains a character that is not in verify_string. If no invalid data exists, the returned value will be 0.</p>
<p>Initial solution:  IF verify(ID, &#8216;XYZ012345&#8242;) then &#8230;.;<br />
Suppose ID = &#8216;X12B44&#8242;, the returned value is then 4.</p>
<p>potential problems:<br />
1. varying length of a variable: There are training blanks which are considered as characters and not in the verify_string.<br />
verify(trim(ID), &#8216;XYZ012345&#8242;)<br />
will return 0 for all valid values of ID, even though they are shorter then specified length.<br />
2. Missing value: The expression above will return a 1 for a missing value of ID. Missing values are considered the same as blanks.<br />
Solution: use missing function</p>
<p>Final solution: if verify(trim(ID), &#8216;XYZ012345&#8242;) and not missing(ID) then &#8230;;</p>
<p>In SAS 9 or higher version, you can use NOTDIGIT function:<br />
notdigit(character_value) is equivalent to<br />
verify(character_value, &#8217;0123456789&#8242;)</p>
<br />Posted in SAS  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phillippeng.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phillippeng.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phillippeng.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phillippeng.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phillippeng.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phillippeng.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phillippeng.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phillippeng.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phillippeng.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phillippeng.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phillippeng.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phillippeng.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phillippeng.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phillippeng.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=85&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phillippeng.wordpress.com/2009/07/29/sas-verify-function-to-check-invalid-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f388fc20f86b84a6c400fed38e390fac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phillippeng</media:title>
		</media:content>
	</item>
		<item>
		<title>SAS Macro &#8211; Get missing counts for all character variables</title>
		<link>http://phillippeng.wordpress.com/2009/07/23/sas-macro-get-missing-counts-for-all-character-variables/</link>
		<comments>http://phillippeng.wordpress.com/2009/07/23/sas-macro-get-missing-counts-for-all-character-variables/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 16:16:37 +0000</pubDate>
		<dc:creator>phillippeng</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[data management]]></category>
		<category><![CDATA[PROC SQL]]></category>
		<category><![CDATA[sas macro]]></category>

		<guid isPermaLink="false">http://phillippeng.wordpress.com/?p=75</guid>
		<description><![CDATA[A SAS macro to get the missing counts for all character variables in a dataset. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=75&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>%macro charvar_nmiss(base,dsn, outds);<br />
<span style="color:#000080;">*Counting number of character variables in the dataset;</span><br />
proc contents data=&amp;base..&amp;dsn out=dsn_vars(keep=name type)  noprint; run;</p>
<p>data dsn_vars; set dsn_vars; where type = 2; seqno = _n_; run;</p>
<p>proc sql;<br />
select name into: varlist<br />
separated by &#8216; &#8216;<br />
from dsn_vars;<br />
quit;</p>
<p>proc sql noprint;<br />
select count(*)into :nvars from dsn_vars;<br />
quit;</p>
<p><span style="color:#000080;">*Get the missing counts for each character variable in the dataset;</span><br />
%do i = 1 %to &amp;nvars;<br />
%LET varn=%SCAN(&amp;varlist,&amp;i,%STR( ));<br />
proc sql noprint;<br />
create table varnmiss&amp;i as<br />
select distinct &amp;varn., count(*) as nmiss<br />
from &amp;base..&amp;dsn.<br />
where &amp;varn. = &#8216; &#8216;;<br />
quit;<br />
%end;</p>
<p><span style="color:#000080;">*Concatenating all the datasets;</span><br />
data final(keep=id nmiss);<br />
id=_n_;<br />
set %do i= 1 %to &amp;nvars;<br />
varnmiss&amp;i<br />
%end;<br />
;<br />
run;</p>
<p><span style="color:#000080;">*Clean the space;</span><br />
proc datasets nolist; %do i = 1 %to &amp;nvars; delete varnmiss&amp;i; %end; run;</p>
<p><span style="color:#000080;">*Final dataset with list of variables and missing counts;</span><br />
proc sql;<br />
create table &amp;outds as<br />
select a.name ,b.nmiss<br />
from dsn_vars as a, final as b<br />
where a.seqno=b.id;<br />
quit;</p>
<p>%mend;</p>
<br />Posted in SAS Tagged: data management, PROC SQL, sas macro <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phillippeng.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phillippeng.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phillippeng.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phillippeng.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phillippeng.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phillippeng.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phillippeng.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phillippeng.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phillippeng.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phillippeng.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phillippeng.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phillippeng.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phillippeng.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phillippeng.wordpress.com/75/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=75&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phillippeng.wordpress.com/2009/07/23/sas-macro-get-missing-counts-for-all-character-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f388fc20f86b84a6c400fed38e390fac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phillippeng</media:title>
		</media:content>
	</item>
		<item>
		<title>SAS macro to Load a SAS dataset to SQL Server</title>
		<link>http://phillippeng.wordpress.com/2009/07/22/sas-macro-to-load-a-sas-dataset-to-sql-server/</link>
		<comments>http://phillippeng.wordpress.com/2009/07/22/sas-macro-to-load-a-sas-dataset-to-sql-server/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 18:52:14 +0000</pubDate>
		<dc:creator>phillippeng</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://phillippeng.wordpress.com/?p=72</guid>
		<description><![CDATA[A sas macro to load a sas dataset to SQL server directly.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=72&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>%macro dbload(databasename, userid, password, sasdn, sqltable);<br />
proc dbload dbms=odbc data=&amp;sasdn.;<br />
dsn=&amp;databasename;<br />
uid=&amp;userid;<br />
pwd=&amp;password;<br />
table=&#8221;&amp;sqltable.&#8221;;<br />
limit=0;<br />
load;<br />
run;<br />
%mend dbload;</p>
<p>You can define a libname using odbc and then load the data through data step. However, there are advantages with PROC DBLOAD over data step:</p>
<p>1. You can re-define the column data type for the loaded table.<br />
2. You can use PROC DBLOAD APPEND to just append new records to a table.</p>
<br />Posted in SAS, SQL  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phillippeng.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phillippeng.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phillippeng.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phillippeng.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phillippeng.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phillippeng.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phillippeng.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phillippeng.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phillippeng.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phillippeng.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phillippeng.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phillippeng.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phillippeng.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phillippeng.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=72&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phillippeng.wordpress.com/2009/07/22/sas-macro-to-load-a-sas-dataset-to-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f388fc20f86b84a6c400fed38e390fac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phillippeng</media:title>
		</media:content>
	</item>
		<item>
		<title>SAS &#8211; Create a file list under the same folder</title>
		<link>http://phillippeng.wordpress.com/2009/07/22/sas-create-a-file-list-under-the-same-folder/</link>
		<comments>http://phillippeng.wordpress.com/2009/07/22/sas-create-a-file-list-under-the-same-folder/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 18:35:03 +0000</pubDate>
		<dc:creator>phillippeng</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[sas macro]]></category>

		<guid isPermaLink="false">http://phillippeng.wordpress.com/?p=69</guid>
		<description><![CDATA[This SAS macro creates a list of files under the same folder. The list can be stored as a sas dataset or a sas macro variable. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=69&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>%let mydir=c:\working directory;<br />
/*DOS command to get a list of all data files programs */<br />
filename mylist pipe &#8220;%str(dir %&#8221;&amp;mydir%&#8221;\pre_* /B) &#8221; lrecl=5000;<br />
/*Adding &#8216;pre_&#8217; gives all the files with a name starting &#8216;pre_&#8217;. To list all the files, just use &#8216;*&#8217; */</p>
<p>/*put the list of files into a data set for macro processing*/<br />
data mylist;<br />
infile mylist truncover;<br />
input filename $char50.;<br />
put _infile_;<br />
run;</p>
<p>proc sql;<br />
select substr(filename,1,10) into:filelist<br />
separated by &#8216; &#8216;<br />
from mylist;<br />
quit;</p>
<p>%put &amp;filelist;</p>
<br />Posted in SAS Tagged: sas macro <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phillippeng.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phillippeng.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phillippeng.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phillippeng.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phillippeng.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phillippeng.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phillippeng.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phillippeng.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phillippeng.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phillippeng.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phillippeng.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phillippeng.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phillippeng.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phillippeng.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=69&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phillippeng.wordpress.com/2009/07/22/sas-create-a-file-list-under-the-same-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f388fc20f86b84a6c400fed38e390fac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phillippeng</media:title>
		</media:content>
	</item>
		<item>
		<title>Stratified sampling in SQL Server</title>
		<link>http://phillippeng.wordpress.com/2009/07/09/stratefied-sampling-in-sql-server/</link>
		<comments>http://phillippeng.wordpress.com/2009/07/09/stratefied-sampling-in-sql-server/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 16:09:52 +0000</pubDate>
		<dc:creator>phillippeng</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[row_number function]]></category>
		<category><![CDATA[stratified sampling]]></category>

		<guid isPermaLink="false">http://phillippeng.wordpress.com/?p=63</guid>
		<description><![CDATA[There's no well documented way to do stratified sampling in SQL server. I just come up with a solution for this. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=63&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As I know, there&#8217;s no well documented way to do stratified sampling in SQL server. Below is my solution to this need:</p>
<p><span style="color:#000080;">&#8211; randomly sort the table</span></p>
<p>select * into #temp1<br />
from table_name<br />
order by newid()</p>
<p><span style="color:#000080;">&#8211; create group_id</span><br />
select row_number() over(partition by strata_name order by strata_name) as rowid, *<br />
into #temp2<br />
from #temp1</p>
<p><span style="color:#000080;">&#8211;set the sample size for each strata. If the sample size (set to 5 in this sample code) is greater than the available counts for a specific group, all the available records are pulled.</span><br />
select strata_name, sampsize = case when counts &gt; 5 then 5 else counts end<br />
into #temp3<br />
from (select strata_name, count(*) as counts<br />
from #temp2 group by strata_name) a<br />
<span style="color:#000080;">&#8211;Pull the sample</span><br />
select a.*<br />
into table_name_sampled<br />
from #temp2 a, #temp3 b<br />
where a.strata_name = b.strata_name and a.rowid &lt;= b.sampsize<br />
<span style="color:#000080;">&#8211; Clean up the temporary tables</span><br />
drop table #temp1<br />
drop table #temp2<br />
drop table #temp3</p>
<br />Posted in SQL Tagged: row_number function, SQL, stratified sampling <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phillippeng.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phillippeng.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phillippeng.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phillippeng.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phillippeng.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phillippeng.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phillippeng.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phillippeng.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phillippeng.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phillippeng.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phillippeng.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phillippeng.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phillippeng.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phillippeng.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phillippeng.wordpress.com&amp;blog=5011059&amp;post=63&amp;subd=phillippeng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phillippeng.wordpress.com/2009/07/09/stratefied-sampling-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f388fc20f86b84a6c400fed38e390fac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">phillippeng</media:title>
		</media:content>
	</item>
	</channel>
</rss>
