<?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: Proc Survey Stratified Random Sampling in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/452842#M23674</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197987"&gt;@Suvendu_Lenka&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;HI ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suppose I have asked to run the coe for sample size 20 however input table contains only 10 in taht case without changing the macri variable value to 10 how can i automate this ? if input table contains less number then we have correct it in macro variable if it is high then we have to consider the value given ti us.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you look at the SELECTALL option for selecting all records if the available sample is less than sampsize?&lt;/P&gt;
&lt;P&gt;The second part, if I understand, is going to be basic data manipulation to count levels of a variable in a data set. Proc Freq, Proc SQL or data step to count the number of actually selected records and reassign a value to a macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if saying about macro variables all are assigned .. the only thing is physicall all macro might not present in inout table in taht case we have to check and commented it as shown in attachment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Provide a very concrete example include some input data, the values of the strata variable, the values of the macro variables and &lt;STRONG&gt;how the macro variables are assigned.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;If your "all macro might not present in inout table in" then why do you set them in the first place? From what you have shown how are we to know which ones aren't needed?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you at least look at the documentation for the SAMPSIZE or SAMPRATE dataset option?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your need to describe in some detail where these macro variables come from and why.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Apr 2018 14:31:14 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-04-10T14:31:14Z</dc:date>
    <item>
      <title>Proc Survey Stratified Random Sampling</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/452711#M23650</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to automate existing proc survey select procedure. We have provided sample size by business every quarter of some groups.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We update the samaple size in macro code then run the programme. Sometimes it happned given sample size do nt match with actual tdata present in input table hence it provide error then accoridng to actually data we update the sample size then we run it again.. this thing I have to Automate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Secondly..We use "STRATA" function with this code as well. It happend same group is not present in input table also in that case we have to comment out the not exist group in code before running. You can see attched code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So we can automate this to avoid such scenerio .Instead of manual upadating code will check and do the needful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For ref please find attched code.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 05:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/452711#M23650</guid>
      <dc:creator>Suvendu_Lenka</dc:creator>
      <dc:date>2018-04-10T05:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Survey Stratified Random Sampling</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/452713#M23651</link>
      <description>&lt;P&gt;You should provide some example of what "given sample size do nt match with actual tdata present in input" means. As in how does in not match? If you ask for 25 records and there are only 10 for a specific strata what do you want to happen?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that there is an option, SELECTALL, to select all records of a strata if there are not as many as you desire.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you have what appears at first glance to be about 30 macro variables and description of how any of them are assigned that is something else to consider.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this were my project I might be tempted to see if SAMPRATE instead of SAMPSIZE were more appropriate. I could set the rate for a common percentage, possibly with an NMAX option.&lt;/P&gt;
&lt;P&gt;Something else to consider are the use of control data sets. You could likely build either a SAMPSIZE or SAMPRATE data set that has the strata identification and desired size as a value of _NSIZE_ or _RATE_ instead of a laundry list of macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your sampsize data set could look like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Group (the strata variable) _nsize_&lt;/P&gt;
&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&lt;/P&gt;
&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&lt;/P&gt;
&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&lt;/P&gt;
&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 135&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;until you have all of the values of group in your current input data set. Just make sure that you do not have any values of group in the SAMPSIZE set that do not appear in the data. _nsize_ has the typical rules for size variables.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 06:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/452713#M23651</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-10T06:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Survey Stratified Random Sampling</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/452714#M23652</link>
      <description>&lt;P&gt;I moved the question to the Statistical Procedures community, where it belongs.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 06:21:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/452714#M23652</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-10T06:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Survey Stratified Random Sampling</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/452715#M23657</link>
      <description>&lt;P&gt;HI ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suppose I have asked to run the coe for sample size 20 however input table contains only 10 in taht case without changing the macri variable value to 10 how can i automate this ? if input table contains less number then we have correct it in macro variable if it is high then we have to consider the value given ti us.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if saying about macro variables all are assigned .. the only thing is physicall all macro might not present in inout table in taht case we have to check and commented it as shown in attachment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 06:31:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/452715#M23657</guid>
      <dc:creator>Suvendu_Lenka</dc:creator>
      <dc:date>2018-04-10T06:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Survey Stratified Random Sampling</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/452842#M23674</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197987"&gt;@Suvendu_Lenka&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;HI ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suppose I have asked to run the coe for sample size 20 however input table contains only 10 in taht case without changing the macri variable value to 10 how can i automate this ? if input table contains less number then we have correct it in macro variable if it is high then we have to consider the value given ti us.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you look at the SELECTALL option for selecting all records if the available sample is less than sampsize?&lt;/P&gt;
&lt;P&gt;The second part, if I understand, is going to be basic data manipulation to count levels of a variable in a data set. Proc Freq, Proc SQL or data step to count the number of actually selected records and reassign a value to a macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if saying about macro variables all are assigned .. the only thing is physicall all macro might not present in inout table in taht case we have to check and commented it as shown in attachment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Provide a very concrete example include some input data, the values of the strata variable, the values of the macro variables and &lt;STRONG&gt;how the macro variables are assigned.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;If your "all macro might not present in inout table in" then why do you set them in the first place? From what you have shown how are we to know which ones aren't needed?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you at least look at the documentation for the SAMPSIZE or SAMPRATE dataset option?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your need to describe in some detail where these macro variables come from and why.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 14:31:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/452842#M23674</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-10T14:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Survey Stratified Random Sampling</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/453022#M23690</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884" target="_self"&gt;ballardw&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thank you so much . SELECTALL option is working for me and it is taking the sample size avaliable in dataset if it is less than the sample size given in programme. Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;But still I am struggling for strata group. If you see my code I have commented many strata group because sometimes this are not avaliable in input data set but not always . it menas ne next run it might happen i have to uncommented some of the strata group from the comment.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Basically the queston is "&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;How can I sample from some of the strata in my data while ignoring others? "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;For example :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;%let rcanum1= 5180;&lt;BR /&gt;%let rcanum2= 4776;&lt;BR /&gt;%let rcanum3= 3240;&lt;BR /&gt;%let rcanum4= 5064;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;BR /&gt;proc surveyselect data = work.claima&lt;BR /&gt;sampsize = (&amp;amp;rcanum1., &amp;amp;rcanum2., &amp;amp;rcanum3., &amp;amp;rcanum4.)&lt;BR /&gt;method = srs&lt;BR /&gt;out = work.samplea SELECTALL;&lt;BR /&gt;strata group;&lt;BR /&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;In next run "&lt;SPAN&gt;&amp;amp;rcanum2" is not avliable like &amp;nbsp;:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;SPAN&gt;%let rcanum1= 5180;&lt;BR /&gt;%let rcanum3= 3240;&lt;BR /&gt;%let rcanum4= 5064;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;SPAN&gt;I dont wnat to go &amp;amp; correct teh code by deleting the value from sample size &amp;amp; will again run .. the code should automatic check &amp;amp; provide me output without warning &amp;amp; error for 3 group. is there any option ??&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;SPAN&gt;Hope you understand ! &amp;nbsp;Thanks in advance.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 03:20:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Survey-Stratified-Random-Sampling/m-p/453022#M23690</guid>
      <dc:creator>Suvendu_Lenka</dc:creator>
      <dc:date>2018-04-11T03:20:46Z</dc:date>
    </item>
  </channel>
</rss>

