<?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 select - Random sampling in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-select-Random-sampling/m-p/290662#M59784</link>
    <description>&lt;P&gt;If you use '=', you create a variable with the name 'output'. Then a second&amp;nbsp;variable is created with the file name 'devsample'. Because there are no entries for 'devsample', in effect you are creating 2 variables with missing values, and write it to the (/all) data files declared in the DATA-statement at the beginning.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Aug 2016 09:30:03 GMT</pubDate>
    <dc:creator>user24feb</dc:creator>
    <dc:date>2016-08-10T09:30:03Z</dc:date>
    <item>
      <title>Proc Survey select - Random sampling</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-select-Random-sampling/m-p/290430#M59739</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I'm trying to sample data into development sample and validation sample using proc surveyselect, but the output shown is not sampled returning the same original dataset.The code I used is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc surveyselect data=stores1 out=devsample method=srs samprate=0.5 outall;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also used ranuni function but the result is same , no sampling is done&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt; data devsample;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; set stores1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; if ranuni(100)&amp;lt;0.50 then output=devsample;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;please correct me where I went wrong&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 11:54:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-select-Random-sampling/m-p/290430#M59739</guid>
      <dc:creator>ajbarla</dc:creator>
      <dc:date>2016-08-09T11:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Survey select - Random sampling</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-select-Random-sampling/m-p/290448#M59740</link>
      <description>&lt;P&gt;Both seem o.k. (remove "=" from the&amp;nbsp;2nd program).&amp;nbsp;Do you get an error? Could stores1 be empty? ..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Stores1;
  Do ID1=1 To 30;
    Do ID2=1 To 30;
      Value=Ranuni(1);
	  Output;
	End;
  End;
Run;

proc surveyselect data=stores1 out=devsample method=srs samprate=0.5 outall;
run;

data devsample2;
  set stores1;
  if ranuni(100)&amp;lt;0.50 then output devsample2; * remove equal sign!;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Aug 2016 12:55:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-select-Random-sampling/m-p/290448#M59740</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2016-08-09T12:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Survey select - Random sampling</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-select-Random-sampling/m-p/290487#M59748</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hi,&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc surveyselect data=stores1 out=devsample method=srs samprate=0.5 outall;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;outall option creates a variable "selected" that provides a flag to separate two data sets. You need a data step to create two data sets. Please try this after proc surveyselect:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data develop validate;&lt;BR /&gt;set devsample;&lt;BR /&gt;if selected then output develop;&lt;BR /&gt;else output validate;&lt;BR /&gt;run;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 15:15:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-select-Random-sampling/m-p/290487#M59748</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2016-08-09T15:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Survey select - Random sampling</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-select-Random-sampling/m-p/290659#M59783</link>
      <description>&lt;P&gt;what happens when '=' is used ?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 09:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-select-Random-sampling/m-p/290659#M59783</guid>
      <dc:creator>ajbarla</dc:creator>
      <dc:date>2016-08-10T09:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Survey select - Random sampling</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-select-Random-sampling/m-p/290662#M59784</link>
      <description>&lt;P&gt;If you use '=', you create a variable with the name 'output'. Then a second&amp;nbsp;variable is created with the file name 'devsample'. Because there are no entries for 'devsample', in effect you are creating 2 variables with missing values, and write it to the (/all) data files declared in the DATA-statement at the beginning.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 09:30:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-select-Random-sampling/m-p/290662#M59784</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2016-08-10T09:30:03Z</dc:date>
    </item>
  </channel>
</rss>

