<?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 set sampsize as count of table/4 in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123946#M34084</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is due to the sampling method you are using (URS), which allows replacement (i.e. it can select the same observation more than once).&amp;nbsp; The output dataset will only contain the unique values, so any duplicate observations have been dropped.&amp;nbsp; If you change the method to SRS then you will always get 25% of the observations each time.&lt;/P&gt;&lt;P&gt;I suggest you read up on the PROC SURVEYSELECT documentation, this gives you all the answers to your questions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Aug 2013 12:38:51 GMT</pubDate>
    <dc:creator>Keith</dc:creator>
    <dc:date>2013-08-28T12:38:51Z</dc:date>
    <item>
      <title>How to set sampsize as count of table/4</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123940#M34078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I want to get a random sample from a table but I&amp;nbsp; want output number as %25 of the table count&lt;/P&gt;&lt;P&gt;here is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc surveyselect data=temp.tableA&amp;nbsp; method = urs sampsize = ???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; rep=1 seed=12345 out=temp.sonuc out=outhits;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; id bayi pos key&amp;nbsp; msisdn;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc print data = temp.sonuc noobs;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can I put sampsize=count(tableA)/4&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;or the %25 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example table has 1000 row&lt;/P&gt;&lt;P&gt;but I need output number 250&lt;/P&gt;&lt;P&gt;but I do not put it hard coded&lt;/P&gt;&lt;P&gt;it must calculate the count of table then it must take 1/4 of the numberr &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 11:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123940#M34078</guid>
      <dc:creator>sayginf</dc:creator>
      <dc:date>2013-08-28T11:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to set sampsize as count of table/4</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123941#M34079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could create a macro variable based on the number of obs in the dataset using the following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET DSID = %SYSFUNC(OPEN(SASHELP.CLASS));&lt;/P&gt;&lt;P&gt;%LET NUMOBS = %SYSFUNC(ATTRN(&amp;amp;DSID.,NOBS));&lt;/P&gt;&lt;P&gt;%LET SAMP = %SYSEVALF(&amp;amp;NUMOBS./4,CEIL);&lt;/P&gt;&lt;P&gt;%LET RC&amp;nbsp;&amp;nbsp; = %SYSFUNC(CLOSE(&amp;amp;DSID));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%PUT *****************************&amp;amp;NUMOBS. &amp;amp;SAMP.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited to make use of the CEIL modifier.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 11:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123941#M34079</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2013-08-28T11:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to set sampsize as count of table/4</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123942#M34080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to use the SAMPRATE option instead of SAMPSIZE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc surveyselect data=temp.tableA&amp;nbsp; method = urs samprate = 0.25&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 11:56:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123942#M34080</guid>
      <dc:creator>Keith</dc:creator>
      <dc:date>2013-08-28T11:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to set sampsize as count of table/4</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123943#M34081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can't you SAMPRATE= option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SAMPRATE=&lt;EM&gt;r&lt;/EM&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RATE=&lt;EM&gt;r&lt;/EM&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="syntaxindex" id="statug.surveyselect.a0000000075"&gt; &lt;/A&gt;&lt;A class="syntaxindex" id="statug.surveyselect.a0000000076"&gt; &lt;/A&gt;&lt;A class="subjectindex" id="statug.surveyselect.a0000000077"&gt; &lt;/A&gt;specifies the sampling rate, which is the proportion of units to select for the sample. The sampling rate &lt;EM&gt;r&lt;/EM&gt; must be a positive number. You can specify &lt;EM&gt;r&lt;/EM&gt; as a number between 0 and 1. Or you can specify &lt;EM&gt;r&lt;/EM&gt; in percentage form as a number between 1 and 100, and PROC SURVEYSELECT converts that number to a proportion. The procedure treats the value 1 as 100% instead of 1%. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 12:00:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123943#M34081</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-08-28T12:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to set sampsize as count of table/4</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123944#M34082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made what you said but it brings to me not exactly 1/4 of the table&lt;/P&gt;&lt;P&gt;for example my table has 425019 row&lt;/P&gt;&lt;P&gt;but the code brings to me 94239 row &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I changed the extra features from the code but it did not change&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc surveyselect data=&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;temp.tableA &lt;/SPAN&gt; method = urs samprate = 0.25&lt;/P&gt;&lt;P&gt;&amp;nbsp; seed=12345 out=&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;temp.sonuc&lt;/SPAN&gt; ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 12:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123944#M34082</guid>
      <dc:creator>sayginf</dc:creator>
      <dc:date>2013-08-28T12:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to set sampsize as count of table/4</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123945#M34083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you but I do not know how to write macro yet &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;but I will learn in near future &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 12:20:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123945#M34083</guid>
      <dc:creator>sayginf</dc:creator>
      <dc:date>2013-08-28T12:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to set sampsize as count of table/4</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123946#M34084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is due to the sampling method you are using (URS), which allows replacement (i.e. it can select the same observation more than once).&amp;nbsp; The output dataset will only contain the unique values, so any duplicate observations have been dropped.&amp;nbsp; If you change the method to SRS then you will always get 25% of the observations each time.&lt;/P&gt;&lt;P&gt;I suggest you read up on the PROC SURVEYSELECT documentation, this gives you all the answers to your questions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 12:38:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123946#M34084</guid>
      <dc:creator>Keith</dc:creator>
      <dc:date>2013-08-28T12:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to set sampsize as count of table/4</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123947#M34085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much,&lt;/P&gt;&lt;P&gt;I will read of course but this was urgent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 12:50:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123947#M34085</guid>
      <dc:creator>sayginf</dc:creator>
      <dc:date>2013-08-28T12:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to set sampsize as count of table/4</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123948#M34086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would never trust an urgent need to the whims of a user forum.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 13:27:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123948#M34086</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-08-28T13:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to set sampsize as count of table/4</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123949#M34087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Likewise I would never run some SAS code without understanding what it was doing!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 13:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-sampsize-as-count-of-table-4/m-p/123949#M34087</guid>
      <dc:creator>Keith</dc:creator>
      <dc:date>2013-08-28T13:44:29Z</dc:date>
    </item>
  </channel>
</rss>

