<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Add dummy column to flag random sample from population in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Add-dummy-column-to-flag-random-sample-from-population/m-p/341703#M78241</link>
    <description>&lt;P&gt;Here's a simple example using surveyselect (just 50 for the example). If you have the sort order the same on the frame and use the same seed, you'll keep the same sampled IDs every time you run it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data frame;
    do id = 1 to 50;
        output;
    end;
run;

proc surveyselect data = frame
    method = srs
    n = 35
    out = sample outall;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 16 Mar 2017 18:04:44 GMT</pubDate>
    <dc:creator>collinelliot</dc:creator>
    <dc:date>2017-03-16T18:04:44Z</dc:date>
    <item>
      <title>Add dummy column to flag random sample from population</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-dummy-column-to-flag-random-sample-from-population/m-p/341695#M78236</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does someone have suggestion code to offer on how I can assign a dummy variable (1 or 0) to identify a random sample from a population?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say I have a population of 1,800 records and I want to flag exactly 35, randomly. The random sample volume will always remain the same. I want to retain the full 1,800 records, but with a column that can be filtered to, say, 1, to identify the random sample.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 17:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-dummy-column-to-flag-random-sample-from-population/m-p/341695#M78236</guid>
      <dc:creator>brulard</dc:creator>
      <dc:date>2017-03-16T17:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Add dummy column to flag random sample from population</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-dummy-column-to-flag-random-sample-from-population/m-p/341697#M78238</link>
      <description>&lt;P&gt;Use the right procedure and this gets easy:&lt;/P&gt;
&lt;PRE&gt;proc surveyselect data=yourdatasetgoeshere out=selected outall
   sampsize=35;
run;
&lt;/PRE&gt;
&lt;P&gt;The OUTALL option says to output all records from input dataset and add a variable named SELECTED which has values 0/1 with 1 indicating those selected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 17:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-dummy-column-to-flag-random-sample-from-population/m-p/341697#M78238</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-16T17:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Add dummy column to flag random sample from population</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-dummy-column-to-flag-random-sample-from-population/m-p/341703#M78241</link>
      <description>&lt;P&gt;Here's a simple example using surveyselect (just 50 for the example). If you have the sort order the same on the frame and use the same seed, you'll keep the same sampled IDs every time you run it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data frame;
    do id = 1 to 50;
        output;
    end;
run;

proc surveyselect data = frame
    method = srs
    n = 35
    out = sample outall;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Mar 2017 18:04:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-dummy-column-to-flag-random-sample-from-population/m-p/341703#M78241</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-03-16T18:04:44Z</dc:date>
    </item>
  </channel>
</rss>

