<?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: Best way to use PROC SURVEYSELECT in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76347#M22128</link>
    <description>_null_,&lt;BR /&gt;
Thank you for your reply.&lt;BR /&gt;
&lt;BR /&gt;
I have another issue that just popped up. How can I do this based on a user column?&lt;BR /&gt;
&lt;BR /&gt;
I have a user column and I have to take the top 20 rows per user and the first row of every 10 for each user.  &lt;BR /&gt;
&lt;BR /&gt;
I do apologize for my newbie questions.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for all the help</description>
    <pubDate>Fri, 23 Oct 2009 14:03:20 GMT</pubDate>
    <dc:creator>jerry898969</dc:creator>
    <dc:date>2009-10-23T14:03:20Z</dc:date>
    <item>
      <title>Best way to use PROC SURVEYSELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76343#M22124</link>
      <description>I'm having a hard time grasping how to use SURVEYSELECT.&lt;BR /&gt;
&lt;BR /&gt;
I have a data table that I need to take the top 20 rows then a random sample row out of 10 row chunks till my entire dataset has been gone through.&lt;BR /&gt;
&lt;BR /&gt;
So I have the first 20 then from 21 to 30 I need to randomly pick a row. Then from 31 to 40 I need to randomly pick another row and so on till it goes through my dataset.&lt;BR /&gt;
&lt;BR /&gt;
Is this possible use SURVEYSELECT?  &lt;BR /&gt;
&lt;BR /&gt;
Any help would be greatly appreciated&lt;BR /&gt;
&lt;BR /&gt;
Thank You</description>
      <pubDate>Wed, 21 Oct 2009 13:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76343#M22124</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2009-10-21T13:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to use PROC SURVEYSELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76344#M22125</link>
      <description>I think you need to stratify the observations into first 20 then by 10s until the EOF.  You will also need a SAMPSIZE data set with _NSIZE_ and the strata variable.  I think this is what you want.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data shoes size(keep=strata _nsize_); &lt;BR /&gt;
   strata = 1;&lt;BR /&gt;
   _nsize_   = 20;&lt;BR /&gt;
   output size;&lt;BR /&gt;
   do i = 1 to _nsize_ until(eof);&lt;BR /&gt;
      link set;&lt;BR /&gt;
      output shoes;&lt;BR /&gt;
      end;&lt;BR /&gt;
   _nsize_ = 1;&lt;BR /&gt;
   do i = 1 by 1 until(eof);&lt;BR /&gt;
      link set;&lt;BR /&gt;
      if mod(i,10) eq 1 then do;&lt;BR /&gt;
         strata + 1;&lt;BR /&gt;
         output size;&lt;BR /&gt;
         end;&lt;BR /&gt;
      output shoes;&lt;BR /&gt;
      end;&lt;BR /&gt;
   stop;&lt;BR /&gt;
 set:&lt;BR /&gt;
   set sashelp.shoes end=eof;&lt;BR /&gt;
   return;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print data=size;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
proc surveyselect data=shoes sampsize=size;&lt;BR /&gt;
   strata strata;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 21 Oct 2009 17:09:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76344#M22125</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-10-21T17:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to use PROC SURVEYSELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76345#M22126</link>
      <description>_null_,&lt;BR /&gt;
Thank you so much&lt;BR /&gt;
&lt;BR /&gt;
I just got out of a meeting where they changed the requirements.  Now I have to take the first 20 then the first row out of 10 row chunks.&lt;BR /&gt;
&lt;BR /&gt;
So first 20, 21,31,41 till the end.  Do I still need to use SurveySelect to do this or can I do it a more simple way?&lt;BR /&gt;
&lt;BR /&gt;
Thank you again for your quick response.</description>
      <pubDate>Wed, 21 Oct 2009 17:35:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76345#M22126</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2009-10-21T17:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to use PROC SURVEYSELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76346#M22127</link>
      <description>You don't need surveyselect if you don't need a random sample.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
dm 'clear log; clear output;';&lt;BR /&gt;
data sample;&lt;BR /&gt;
   do i = 1 to 20;&lt;BR /&gt;
      link set;&lt;BR /&gt;
      output;&lt;BR /&gt;
      end;&lt;BR /&gt;
   do i = 21 by 10 while(i le nobs);&lt;BR /&gt;
      link set;&lt;BR /&gt;
      output;&lt;BR /&gt;
      end;&lt;BR /&gt;
   stop;&lt;BR /&gt;
 set:&lt;BR /&gt;
   set sashelp.shoes point=i nobs=nobs;&lt;BR /&gt;
   return;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 21 Oct 2009 17:48:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76346#M22127</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-10-21T17:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to use PROC SURVEYSELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76347#M22128</link>
      <description>_null_,&lt;BR /&gt;
Thank you for your reply.&lt;BR /&gt;
&lt;BR /&gt;
I have another issue that just popped up. How can I do this based on a user column?&lt;BR /&gt;
&lt;BR /&gt;
I have a user column and I have to take the top 20 rows per user and the first row of every 10 for each user.  &lt;BR /&gt;
&lt;BR /&gt;
I do apologize for my newbie questions.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for all the help</description>
      <pubDate>Fri, 23 Oct 2009 14:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76347#M22128</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2009-10-23T14:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to use PROC SURVEYSELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76348#M22129</link>
      <description>The has to read all the obs in the data but if you don't have a huge data set it may be good enough.  I you want to just read the selected obs let me know, but that is a little harder.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data sample2;&lt;BR /&gt;
   do i=1 by 1 until(last.region);&lt;BR /&gt;
      set sashelp.shoes;&lt;BR /&gt;
      by region;&lt;BR /&gt;
      if 1 le i le 20 or mod(i,10) eq 1 then output;&lt;BR /&gt;
      end;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 23 Oct 2009 18:45:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76348#M22129</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-10-23T18:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to use PROC SURVEYSELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76349#M22130</link>
      <description>_null_,&lt;BR /&gt;
Thank you so much for your help.  I only had a bit to test it but it seems to be dead on.  My full set is only around 1100 rows so it's small enough for this to work good.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks again</description>
      <pubDate>Fri, 23 Oct 2009 20:36:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Best-way-to-use-PROC-SURVEYSELECT/m-p/76349#M22130</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2009-10-23T20:36:24Z</dc:date>
    </item>
  </channel>
</rss>

