<?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 Using ranuni for a sample....would like to rerun the query with a new sample in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-ranuni-for-a-sample-would-like-to-rerun-the-query-with-a/m-p/861853#M340408</link>
    <description>&lt;P class=""&gt;In the following query, I am trying to take a 10% sample of the data to create a contact list.&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Next month, I'd like to pull another sample (run the same query) but not include previously identified contacts (new records sampled in the query)&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Any idea on how to do this?&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;CREATE TABLE TejonOwned AS&lt;/P&gt;&lt;P class=""&gt;SELECT *, COUNT(t1.PlayerId)&lt;/P&gt;&lt;P class=""&gt;FROM TDQT.vCXPlayer_SAS t1&lt;/P&gt;&lt;P class=""&gt;WHERE t1.SubFightZone = "Tejon Owned" AND RANUNI(4321) between .045 and .055 ;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Mar 2023 21:35:23 GMT</pubDate>
    <dc:creator>rrmenon</dc:creator>
    <dc:date>2023-03-01T21:35:23Z</dc:date>
    <item>
      <title>Using ranuni for a sample....would like to rerun the query with a new sample</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-ranuni-for-a-sample-would-like-to-rerun-the-query-with-a/m-p/861853#M340408</link>
      <description>&lt;P class=""&gt;In the following query, I am trying to take a 10% sample of the data to create a contact list.&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Next month, I'd like to pull another sample (run the same query) but not include previously identified contacts (new records sampled in the query)&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Any idea on how to do this?&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;CREATE TABLE TejonOwned AS&lt;/P&gt;&lt;P class=""&gt;SELECT *, COUNT(t1.PlayerId)&lt;/P&gt;&lt;P class=""&gt;FROM TDQT.vCXPlayer_SAS t1&lt;/P&gt;&lt;P class=""&gt;WHERE t1.SubFightZone = "Tejon Owned" AND RANUNI(4321) between .045 and .055 ;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 21:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-ranuni-for-a-sample-would-like-to-rerun-the-query-with-a/m-p/861853#M340408</guid>
      <dc:creator>rrmenon</dc:creator>
      <dc:date>2023-03-01T21:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using ranuni for a sample....would like to rerun the query with a new sample</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-ranuni-for-a-sample-would-like-to-rerun-the-query-with-a/m-p/861871#M340417</link>
      <description>&lt;P&gt;Are you going to be running the selection on the same data set? The output of this process? Or a completely new data set that you need to remove the previously selected records from? The current data set with records appended? It isn't quite clear what we are supposed to select from in the future.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure what your Count(t1.playerid) is intended to accomplish since we have none of your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I would use Proc Surveyselect to pull records as it allows setting a SAMPRATE=10 (for example for 10 percent) and I don't have to fool with picking an (incorrect) interval for ranuni or Rand('uniform') (.45 to .55 is 11% when you consider the end points)&lt;/P&gt;
&lt;P&gt;You would use the result of the first selection to mark records in which ever set to select the second one before selection. Typically a join or merge matching on the ID variables and setting flag. Then select where the value is not the flag.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 23:45:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-ranuni-for-a-sample-would-like-to-rerun-the-query-with-a/m-p/861871#M340417</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-01T23:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using ranuni for a sample....would like to rerun the query with a new sample</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-ranuni-for-a-sample-would-like-to-rerun-the-query-with-a/m-p/861912#M340429</link>
      <description>&lt;P&gt;The method you show here may work with your input data, but don't count on it. PROC SQL does not guarantee that records are read in the same order, meaning that it is not certain that you will get the same output every time, even if your input data stays the same (SQL may work differently, and fetch data in a different order, if your system is changed in some way).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your data is the same every month (and in the same order), a data step may guarantee that you get the same extract with the same seed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case, you can do something like this the first month:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data TejonOwned;
  set TDQT.vCXPlayer_SAS t1;
  WHERE t1.SubFightZone = "Tejon Owned"; 
  if  RANUNI(4321) &amp;lt;0.1 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And in the second month, just move on to the next decile, with the same seed:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data TejonOwned;
  set TDQT.vCXPlayer_SAS t1;
  WHERE t1.SubFightZone = "Tejon Owned"; 
  if  0.1&amp;lt;=RANUNI(4321) &amp;lt;0.2 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Mar 2023 09:16:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-ranuni-for-a-sample-would-like-to-rerun-the-query-with-a/m-p/861912#M340429</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2023-03-02T09:16:40Z</dc:date>
    </item>
  </channel>
</rss>

