<?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: Random sampling in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Random-sampling/m-p/841170#M332584</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321775"&gt;@Chris_LK_87&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the &lt;A href="https://documentation.sas.com/doc/en/statug/15.2/statug_surveyselect_syntax05.htm" target="_blank" rel="noopener"&gt;CLUSTER statement&lt;/A&gt; of &lt;A href="https://documentation.sas.com/doc/en/statug/15.2/statug_surveyselect_overview.htm" target="_blank" rel="noopener"&gt;PROC SURVEYSELECT&lt;/A&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyselect data=have
method=srs n=4 /* use n=1000 for your real data */
seed=6180339 out=want;
cluster id;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 27 Oct 2022 15:32:28 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2022-10-27T15:32:28Z</dc:date>
    <item>
      <title>Random sampling</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Random-sampling/m-p/841138#M332579</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a dataset with millions of individuals.&amp;nbsp; Each individual can appear more than once. I would like to randomly select a samplesize of n=1000. The only criteria is that I want to select the same individual always and their cases. As shown in data want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;length id $10 Type $10;&lt;BR /&gt;input id$ Type$;&lt;BR /&gt;datalines;&lt;BR /&gt;1 A&lt;BR /&gt;1 B&lt;BR /&gt;1 D&lt;BR /&gt;2 A&lt;BR /&gt;2 F&lt;BR /&gt;3 L&lt;BR /&gt;4 E&lt;BR /&gt;4 T&lt;BR /&gt;5 H&lt;BR /&gt;6 J&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;length id $10 Type $10;&lt;BR /&gt;input id$ Type$;&lt;BR /&gt;datalines;&lt;BR /&gt;1 A&lt;BR /&gt;1 B&lt;BR /&gt;1 D&lt;BR /&gt;3 L&lt;BR /&gt;4 E&lt;BR /&gt;4 T&lt;BR /&gt;6 J&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 13:48:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Random-sampling/m-p/841138#M332579</guid>
      <dc:creator>Chris_LK_87</dc:creator>
      <dc:date>2022-10-27T13:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: Random sampling</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Random-sampling/m-p/841140#M332580</link>
      <description>&lt;P&gt;If I am understanding you properly (and I'm not sure that I am, your description seems a little incomplete), you want to sample the distinct ID values with replacement to get 1000 ID values. See:&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2014/01/29/sample-with-replacement-in-sas.html" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/iml/2014/01/29/sample-with-replacement-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can select all the observations from these 1000 ID values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 13:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Random-sampling/m-p/841140#M332580</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-27T13:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Random sampling</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Random-sampling/m-p/841170#M332584</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321775"&gt;@Chris_LK_87&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the &lt;A href="https://documentation.sas.com/doc/en/statug/15.2/statug_surveyselect_syntax05.htm" target="_blank" rel="noopener"&gt;CLUSTER statement&lt;/A&gt; of &lt;A href="https://documentation.sas.com/doc/en/statug/15.2/statug_surveyselect_overview.htm" target="_blank" rel="noopener"&gt;PROC SURVEYSELECT&lt;/A&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyselect data=have
method=srs n=4 /* use n=1000 for your real data */
seed=6180339 out=want;
cluster id;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Oct 2022 15:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Random-sampling/m-p/841170#M332584</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-10-27T15:32:28Z</dc:date>
    </item>
  </channel>
</rss>

