<?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: Select random observation. in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Select-random-observation/m-p/296639#M1065</link>
    <description>&lt;PRE&gt;

proc surveyselect data=sashelp.class out=want sampsize=1;
run;

&lt;/PRE&gt;</description>
    <pubDate>Tue, 06 Sep 2016 06:07:15 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-09-06T06:07:15Z</dc:date>
    <item>
      <title>Select random observation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Select-random-observation/m-p/296555#M1058</link>
      <description>&lt;P&gt;Hii, can any one plz tell how can we retrieve a single random observation(row) from a data set?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2016 15:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Select-random-observation/m-p/296555#M1058</guid>
      <dc:creator>Bipingaud</dc:creator>
      <dc:date>2016-09-05T15:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: question.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Select-random-observation/m-p/296564#M1059</link>
      <description>&lt;P&gt;you can use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;set&lt;/STRONG&gt; input(obs=1, firstobs=) ;&amp;nbsp; /* change firstobs to any row number you want */&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2016 15:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Select-random-observation/m-p/296564#M1059</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-09-05T15:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: question.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Select-random-observation/m-p/296567#M1060</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use some options on the SET statement to achieve this, see example below. Please be aware when using the POINT= option, you also need a STOP statement, as otherwise the DATA Step will loop. Have a look in the doc at the description of the POINT= and NOBS= options. The variable name used in the POINT= option is not written to the output dataset, this is why I use two variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  getObs = ceil( ranuni(0) * numObs);
  _getObs = getObs;
  set sashelp.cars point=_getObs nobs=numObs;
  output;
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also look at Proc SURVEYSELECT for more sophisticated ways to get a random sample from a SAS data set&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2016 15:56:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Select-random-observation/m-p/296567#M1060</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-09-05T15:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Select random observation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Select-random-observation/m-p/296639#M1065</link>
      <description>&lt;PRE&gt;

proc surveyselect data=sashelp.class out=want sampsize=1;
run;

&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Sep 2016 06:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Select-random-observation/m-p/296639#M1065</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-09-06T06:07:15Z</dc:date>
    </item>
  </channel>
</rss>

