<?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: Ransom sample from each group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Ransom-sample-from-each-group/m-p/677876#M204544</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270201"&gt;@Watts&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. You can specify more than one variable in the&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_surveyselect_syntax07.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;STRATA&lt;/A&gt;&amp;nbsp;statement. The groups (strata) are defined by the combination of STRATA variable levels, and samples are selected independently from the separate groups.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;strata origin make;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It gets to be a bit of fun setting the strata sizes if you want different sizes for different combinations of the strata variables. At which point the SAMPSIZE= dataset name may come into play as an easier way to set the sizes than a literal list.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Aug 2020 17:31:29 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-08-19T17:31:29Z</dc:date>
    <item>
      <title>Ransom sample from each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ransom-sample-from-each-group/m-p/677696#M204446</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to take&amp;nbsp; ransom sample of 10 observations for each category of "origin".&lt;/P&gt;
&lt;P&gt;What is the way to do it please?&lt;/P&gt;
&lt;P&gt;In first step I created serial numbers for each group but from this step I don't know how to tell sas to choose 10 observations randomly from each group.&lt;/P&gt;
&lt;P&gt;Please note that the wanted data set will contain 10 observations from each group so since there are 3 origins (Asia,Europe,USA) there will be 30&amp;nbsp;observations in wanted data set&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Erik&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.cars out=cars;
by origin;
run;


data cars2;
set cars;
by origin;
if first.origin then serial=1;
serial+1;
Run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Aug 2020 04:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ransom-sample-from-each-group/m-p/677696#M204446</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-08-19T04:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Ransom sample from each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ransom-sample-from-each-group/m-p/677698#M204448</link>
      <description>&lt;P&gt;One approach is to use&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_surveyselect_toc.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;PROC SURVEYSELECT&lt;/A&gt;.&amp;nbsp;These statements select a random sample of 10 observations from each level of origin.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyselect data=cars2 n=10 out=sample;
     strata origin;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 05:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ransom-sample-from-each-group/m-p/677698#M204448</guid>
      <dc:creator>Watts</dc:creator>
      <dc:date>2020-08-19T05:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Ransom sample from each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ransom-sample-from-each-group/m-p/677702#M204450</link>
      <description>Thank you so much!&lt;BR /&gt;two questions please:&lt;BR /&gt;1- Is the step of creating serial numbers for each group essential?&lt;BR /&gt;2-What is the process if the "group" is defined by multiple fields?&lt;BR /&gt;for example: origin and make fields</description>
      <pubDate>Wed, 19 Aug 2020 05:34:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ransom-sample-from-each-group/m-p/677702#M204450</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-08-19T05:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Ransom sample from each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ransom-sample-from-each-group/m-p/677768#M204502</link>
      <description>&lt;P&gt;1. No, PROC SURVEYSELECT doesn't require that (but it's fine to use some type of sequential ID variable if that's useful for your application). By default, the proc includes all variables from the DATA= input data set in the OUT= sample data set. Alternatively, you can use the&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_surveyselect_syntax04.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;ID&lt;/A&gt;&amp;nbsp;statement to specify which variables to include.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. You can specify more than one variable in the&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_surveyselect_syntax07.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;STRATA&lt;/A&gt;&amp;nbsp;statement. The groups (strata) are defined by the combination of STRATA variable levels, and samples are selected independently from the separate groups.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;strata origin make;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 12:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ransom-sample-from-each-group/m-p/677768#M204502</guid>
      <dc:creator>Watts</dc:creator>
      <dc:date>2020-08-19T12:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Ransom sample from each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ransom-sample-from-each-group/m-p/677876#M204544</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270201"&gt;@Watts&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. You can specify more than one variable in the&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_surveyselect_syntax07.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;STRATA&lt;/A&gt;&amp;nbsp;statement. The groups (strata) are defined by the combination of STRATA variable levels, and samples are selected independently from the separate groups.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;strata origin make;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It gets to be a bit of fun setting the strata sizes if you want different sizes for different combinations of the strata variables. At which point the SAMPSIZE= dataset name may come into play as an easier way to set the sizes than a literal list.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 17:31:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ransom-sample-from-each-group/m-p/677876#M204544</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-19T17:31:29Z</dc:date>
    </item>
  </channel>
</rss>

