<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/language/sas/tags/datastep</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Sun, 19 May 2013 17:05:16 GMT</pubDate>
<item>
<title>(SAS) Selecting a Random Sample of Observations - webonomic</title>
<link>http://snipplr.com/view/63355/selecting-a-random-sample-of-observations/</link>
<description><![CDATA[ <p>You can use the POINT option of the SET statement to efficiently select a random sample of observations from a SAS data set. In addiiton to any statistical reasons for drawing a random sample, the technique is also useful to create test data from a large file. The program shown here efficiently samples a large data set.
It reads only the observations that have been selected using the POINT option.
You assign a variable that is the desired sample size. The example here selects a 10% sample. You can also assign a fixed value (e.g., 100).
The DO loop is iterated for each observation
The uniform function is compared to the percent of observations still to be selected
If the observation is selected, it is read and output and the number needed is decremented by 1
Regardless the number of observations left is reduced by 1
The STOP statement is very important as without it, the DATA step will enter an infinite loop.
This technique works by modifying the threshold as observations are read and selected. Every observation has the same probability of being selected so the technique is statistically valid (If you are a statistician, you probably know this. If not, the analogy of drawing straws is the logic behind this.)</p> ]]></description>
<pubDate>Thu, 16 Feb 2012 02:08:13 GMT</pubDate>
<guid>http://snipplr.com/view/63355/selecting-a-random-sample-of-observations/</guid>
</item>
<item>
<title>(SAS) Create a new variable based on the first non missing value from a list of variables - webonomic</title>
<link>http://snipplr.com/view/41119/create-a-new-variable-based-on-the-first-non-missing-value-from-a-list-of-variables/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 29 Sep 2010 02:55:10 GMT</pubDate>
<guid>http://snipplr.com/view/41119/create-a-new-variable-based-on-the-first-non-missing-value-from-a-list-of-variables/</guid>
</item>
<item>
<title>(SAS) Merging the data sets with a common variable if the datasets has the same prefix name? - sarathannapareddy</title>
<link>http://snipplr.com/view/22277/merging-the-data-sets-with-a-common-variable-if-the-datasets-has-the-same-prefix-name/</link>
<description><![CDATA[ <p>For example: col1-col10 dsn1-dsn 7 data1 to data6 with common variable of Usubjid.

here is the example, I have 7 datasets i need to merge and each of them having the common variable(usubjid) to merge, and all the datasets having the same prefix dsn(dsn1 to dsn7).</p> ]]></description>
<pubDate>Sun, 01 Nov 2009 07:48:29 GMT</pubDate>
<guid>http://snipplr.com/view/22277/merging-the-data-sets-with-a-common-variable-if-the-datasets-has-the-same-prefix-name/</guid>
</item>
<item>
<title>(SAS) Test Dataset: Class - webonomic</title>
<link>http://snipplr.com/view/5626/test-dataset-class/</link>
<description><![CDATA[ <p>This code simply creates a test dataset that can be used when testing new code.</p> ]]></description>
<pubDate>Mon, 31 Mar 2008 12:54:35 GMT</pubDate>
<guid>http://snipplr.com/view/5626/test-dataset-class/</guid>
</item>
</channel>
</rss>