<?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: How to randomly select 'by groups'? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-select-by-groups/m-p/552810#M153706</link>
    <description>&lt;P&gt;Can you please show us the output you want for this data?&lt;/P&gt;</description>
    <pubDate>Mon, 22 Apr 2019 12:36:09 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-04-22T12:36:09Z</dc:date>
    <item>
      <title>How to randomly select 'by groups'?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-select-by-groups/m-p/552809#M153705</link>
      <description>&lt;P&gt;/*I need to separate the "by group of accts" where&amp;nbsp; Arrears_Band at least once has “writoff” value. */&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;informat Current_date date9.;&lt;BR /&gt;Input Current_date&amp;nbsp;&amp;nbsp; Account_number Arrears_Band :$15.;&lt;BR /&gt;Format Current_date date9.;&lt;BR /&gt;cards;&lt;BR /&gt;31MAY2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;BR /&gt;30JUN2011&amp;nbsp; 111&amp;nbsp; writoff&lt;BR /&gt;31JUL2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;BR /&gt;31AUG2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;BR /&gt;30SEP2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;BR /&gt;31OCT2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;BR /&gt;30NOV2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;BR /&gt;31DEC2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;BR /&gt;31JAN2012&amp;nbsp; 111&amp;nbsp; NPNA&lt;BR /&gt;31DEC2011&amp;nbsp; 222&amp;nbsp; NPNA&lt;BR /&gt;31JAN2012&amp;nbsp; 222&amp;nbsp; NPNA&lt;BR /&gt;30NOV2010&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;31DEC2010&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;31JAN2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;28FEB2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;31MAR2011&amp;nbsp; 333&amp;nbsp; writoff&lt;BR /&gt;30APR2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;31MAY2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;30JUN2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;31JUL2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;31AUG2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;30SEP2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;31OCT2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;30NOV2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;31DEC2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;31JAN2012&amp;nbsp; 333&amp;nbsp; NPNA&lt;BR /&gt;28FEB2010&amp;nbsp; 444&amp;nbsp; Current&lt;BR /&gt;31MAR2010&amp;nbsp; 444&amp;nbsp; 30 - 60&lt;BR /&gt;30APR2010&amp;nbsp; 444&amp;nbsp; 30 - 60&lt;BR /&gt;31MAY2010&amp;nbsp; 444&amp;nbsp; Current&lt;BR /&gt;30JUN2010&amp;nbsp; 444&amp;nbsp; Current&lt;BR /&gt;31JUL2010&amp;nbsp; 444&amp;nbsp; Current&lt;BR /&gt;31AUG2010&amp;nbsp; 444&amp;nbsp; Current&lt;BR /&gt;30SEP2010&amp;nbsp; 444&amp;nbsp; Current&lt;BR /&gt;31OCT2010&amp;nbsp; 444&amp;nbsp; Current&lt;BR /&gt;30NOV2010&amp;nbsp; 444&amp;nbsp; Current&lt;BR /&gt;31DEC2010&amp;nbsp; 444&amp;nbsp; Current&lt;BR /&gt;31JAN2011&amp;nbsp; 444&amp;nbsp; 1 - 30&lt;BR /&gt;28FEB2011&amp;nbsp; 444&amp;nbsp; 30 - 60&lt;BR /&gt;31MAR2011&amp;nbsp; 444&amp;nbsp; 60 - 90&lt;BR /&gt;30APR2011&amp;nbsp; 444&amp;nbsp; 90 +&lt;BR /&gt;31MAY2011&amp;nbsp; 444&amp;nbsp; 90 +&lt;BR /&gt;30JUN2011&amp;nbsp; 444&amp;nbsp; 90 +&lt;BR /&gt;31JUL2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;BR /&gt;31AUG2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;BR /&gt;30SEP2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;BR /&gt;31OCT2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;BR /&gt;30NOV2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;BR /&gt;31DEC2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;BR /&gt;31JAN2012&amp;nbsp; 444&amp;nbsp; NPNA&lt;BR /&gt;28FEB2010&amp;nbsp; 555&amp;nbsp; 30 - 60&lt;BR /&gt;31MAR2010&amp;nbsp; 555&amp;nbsp; 30 - 60&lt;BR /&gt;30APR2010&amp;nbsp; 555&amp;nbsp; 60 - 90&lt;BR /&gt;31MAY2010&amp;nbsp; 555&amp;nbsp; NPNA&lt;BR /&gt;31JAN2012&amp;nbsp; 666&amp;nbsp; writoff&lt;BR /&gt;31JAN2012&amp;nbsp; 777&amp;nbsp; NPNA&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/*Below code does do the job and it separates three "by group of accts", accts 111, 333 and 666*/&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;merge have (where=(Arrears_Band='writoff') in=a)&lt;BR /&gt;have (in=b);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;by account_number;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if a and b;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/*Q: Out of the above three "by group of accts", how could I randomly select only 2 bygroups of accts (my original dataset is having several thousand records)?*/&lt;/P&gt;&lt;P&gt;/*Below proc surveyselect selects only 2 individual rows and does not select 2 by groups*/&lt;BR /&gt;PROC SURVEYSELECT DATA=want OUT=need METHOD=SRS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;SAMPSIZE=2 SEED=1234567;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;/*Thanks&lt;BR /&gt;Mirisa&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2019 12:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-select-by-groups/m-p/552809#M153705</guid>
      <dc:creator>dunga</dc:creator>
      <dc:date>2019-04-22T12:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to randomly select 'by groups'?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-select-by-groups/m-p/552810#M153706</link>
      <description>&lt;P&gt;Can you please show us the output you want for this data?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2019 12:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-select-by-groups/m-p/552810#M153706</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-22T12:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to randomly select 'by groups'?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-select-by-groups/m-p/552817#M153709</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SURVEYSELECT DATA=want OUT=need METHOD=SRS
  SAMPSIZE=2 SEED=1234567;

cluster Account_number;

RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Apr 2019 12:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-select-by-groups/m-p/552817#M153709</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-04-22T12:54:59Z</dc:date>
    </item>
  </channel>
</rss>

