<?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: Creating Subset of Samples in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-Subset-of-Samples/m-p/490320#M128249</link>
    <description>&lt;P&gt;Unsure I understand your need.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;I want to keep those observations where bidder is also an asker.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I don't see that in your samples.&lt;/P&gt;
&lt;P&gt;Would this do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
&amp;nbsp; select t1.*&amp;nbsp;
  from HAVE t1
    , (select unique ASKER from HAVE)&amp;nbsp;t2
  where t1.BIDDER&amp;nbsp;=t2.ASKER;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Aug 2018 05:11:50 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-08-28T05:11:50Z</dc:date>
    <item>
      <title>Creating Subset of Samples</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Subset-of-Samples/m-p/490318#M128248</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a stock trading data set which contains 'time', 'bidder', 'asker', 'price', and 'volume'. I want to create sub-samples based on each bidder (If there are 20 bidders, my sub samples will be 20 i. e., sub_sample1, sub-smaple2 and so on..). I want to keep those observations where bidder1 is also an asker somewhere in the asking column, bidder2 is also an asker somewhere in the asking column, and so on. I can do it by putting each bidder's name manually in the programming code but that is not efficient in the sense that if there were&amp;nbsp;thousands of bidder, it would take a lot of time. So I need macro to do it. The files that I have and what I want look like the following. Please note that I am using SAS 9.4. Any help would be highly appreciated.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Zakir&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Data I have" style="width: 599px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22809iC535A6970CA1ABAD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Data I Have.jpg" alt="Data I have" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Data I have&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sub Sample2 I want" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22810iD27123FED6858CDA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Data I want.jpg" alt="Sub Sample2 I want" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Sub Sample2 I want&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sub sample1 I want" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22811iB2544CC060E6EDAD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Subsample2.jpg" alt="Sub sample1 I want" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Sub sample1 I want&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 07:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Subset-of-Samples/m-p/490318#M128248</guid>
      <dc:creator>Zakir</dc:creator>
      <dc:date>2018-08-28T07:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Subset of Samples</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Subset-of-Samples/m-p/490320#M128249</link>
      <description>&lt;P&gt;Unsure I understand your need.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;I want to keep those observations where bidder is also an asker.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I don't see that in your samples.&lt;/P&gt;
&lt;P&gt;Would this do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
&amp;nbsp; select t1.*&amp;nbsp;
  from HAVE t1
    , (select unique ASKER from HAVE)&amp;nbsp;t2
  where t1.BIDDER&amp;nbsp;=t2.ASKER;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 05:11:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Subset-of-Samples/m-p/490320#M128249</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-08-28T05:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Subset of Samples</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Subset-of-Samples/m-p/490355#M128277</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;Thank you for your reply. Unfortunately, it did not work. I have edited the post to make it more clear. Would expect further help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Zakir&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 07:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Subset-of-Samples/m-p/490355#M128277</guid>
      <dc:creator>Zakir</dc:creator>
      <dc:date>2018-08-28T07:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Subset of Samples</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Subset-of-Samples/m-p/490514#M128339</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/228821"&gt;@Zakir&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Chris,&lt;/P&gt;
&lt;P&gt;Thank you for your reply. Unfortunately, it did not work. I have edited the post to make it more clear. Would expect further help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Zakir&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Doesn't work is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are going to provide example data, make sure that 1) your output can be made from the input data 2) Provide the data as a data step. I am not going to type your picture of data to create a data set that code can be tested with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your example "want" data shows only ByronHal as bidder and does not show any example with that as "Asker". So from the demonstrated data there is no way to fulfill your state requirement of "&amp;nbsp;I want to keep those observations where bidder1 is also an asker somewhere in the asking column". So either your requirement is poorly stated or your example data is incomplete in regards to this requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 15:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Subset-of-Samples/m-p/490514#M128339</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-28T15:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Subset of Samples</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Subset-of-Samples/m-p/490653#M128423</link>
      <description>&lt;P&gt;I still don't understand your needs for all the reasons&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;took a lot&amp;nbsp;more care to explain than I would have.&lt;/P&gt;
&lt;P&gt;I suggest that you provide a cut sample with few records, where only 2 output tables are created, and that you detail the logic that you are trying to implement.&lt;/P&gt;
&lt;P&gt;As it is it is unclear.&lt;/P&gt;
&lt;P&gt;Would expect further efforts making your requirements more obvious.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 22:05:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Subset-of-Samples/m-p/490653#M128423</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-08-28T22:05:28Z</dc:date>
    </item>
  </channel>
</rss>

