<?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 Grouping data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Grouping-data/m-p/834206#M329823</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I need small help with grouping of data. Have two variables (id,desc), with below values&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp;desc&lt;BR /&gt;01&amp;nbsp; &amp;nbsp;abc&lt;BR /&gt;01&amp;nbsp; &amp;nbsp;def&lt;BR /&gt;01&amp;nbsp; &amp;nbsp;ghi&lt;BR /&gt;01&amp;nbsp; &amp;nbsp;xyz&lt;BR /&gt;02&amp;nbsp; def&lt;BR /&gt;02&amp;nbsp; ghi&lt;BR /&gt;02&amp;nbsp; xyz&lt;BR /&gt;03&amp;nbsp; lkm&lt;BR /&gt;03&amp;nbsp; ghi&lt;BR /&gt;03&amp;nbsp; opq&lt;BR /&gt;03&amp;nbsp; rst&lt;BR /&gt;04&amp;nbsp; abc&lt;BR /&gt;04&amp;nbsp; opq&lt;BR /&gt;04&amp;nbsp; xyz&lt;/P&gt;&lt;P&gt;I want group id's having desctiptoin only 'def', means&lt;/P&gt;&lt;P&gt;01 def&lt;BR /&gt;02 def&lt;/P&gt;&lt;P&gt;in one dataset&lt;/P&gt;&lt;P&gt;and others in seperate data set.&lt;/P&gt;&lt;P&gt;01 abc&lt;BR /&gt;01 ghi&lt;BR /&gt;01 xyz&lt;BR /&gt;02 ghi&lt;BR /&gt;02 xyz&lt;BR /&gt;03 lkm&lt;BR /&gt;03 ghi&lt;BR /&gt;03 opq&lt;BR /&gt;03 rst&lt;BR /&gt;04 abc&lt;BR /&gt;04 opq&lt;BR /&gt;04 xyz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would like to know how to do this with both Proc sql and datastep(first. and last.)&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Sep 2022 02:52:22 GMT</pubDate>
    <dc:creator>West26</dc:creator>
    <dc:date>2022-09-20T02:52:22Z</dc:date>
    <item>
      <title>Grouping data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-data/m-p/834206#M329823</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I need small help with grouping of data. Have two variables (id,desc), with below values&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp;desc&lt;BR /&gt;01&amp;nbsp; &amp;nbsp;abc&lt;BR /&gt;01&amp;nbsp; &amp;nbsp;def&lt;BR /&gt;01&amp;nbsp; &amp;nbsp;ghi&lt;BR /&gt;01&amp;nbsp; &amp;nbsp;xyz&lt;BR /&gt;02&amp;nbsp; def&lt;BR /&gt;02&amp;nbsp; ghi&lt;BR /&gt;02&amp;nbsp; xyz&lt;BR /&gt;03&amp;nbsp; lkm&lt;BR /&gt;03&amp;nbsp; ghi&lt;BR /&gt;03&amp;nbsp; opq&lt;BR /&gt;03&amp;nbsp; rst&lt;BR /&gt;04&amp;nbsp; abc&lt;BR /&gt;04&amp;nbsp; opq&lt;BR /&gt;04&amp;nbsp; xyz&lt;/P&gt;&lt;P&gt;I want group id's having desctiptoin only 'def', means&lt;/P&gt;&lt;P&gt;01 def&lt;BR /&gt;02 def&lt;/P&gt;&lt;P&gt;in one dataset&lt;/P&gt;&lt;P&gt;and others in seperate data set.&lt;/P&gt;&lt;P&gt;01 abc&lt;BR /&gt;01 ghi&lt;BR /&gt;01 xyz&lt;BR /&gt;02 ghi&lt;BR /&gt;02 xyz&lt;BR /&gt;03 lkm&lt;BR /&gt;03 ghi&lt;BR /&gt;03 opq&lt;BR /&gt;03 rst&lt;BR /&gt;04 abc&lt;BR /&gt;04 opq&lt;BR /&gt;04 xyz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would like to know how to do this with both Proc sql and datastep(first. and last.)&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 02:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-data/m-p/834206#M329823</guid>
      <dc:creator>West26</dc:creator>
      <dc:date>2022-09-20T02:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-data/m-p/834207#M329824</link>
      <description>&lt;P&gt;I don't use either "first." or "last." but how about this simple way of writing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  length id $2 desc $3;
  input id $ desc $;
cards;
01  abc
01  def
01  ghi
01  xyz
02  def
02  ghi
02  xyz
03  lkm
03  ghi
03  opq
03  rst
04  abc
04  opq
04  xyz
;
run;

data one two;
  set have;
  if desc='def' then output one;
  else output two;
run;

proc sql;
  create table one as
  select * from have
  where desc='def';

  create table two as
  select * from have
  where desc^='def';

quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Sep 2022 03:00:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-data/m-p/834207#M329824</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-09-20T03:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-data/m-p/834208#M329825</link>
      <description>&lt;P&gt;Thank you, but I need to reframe my question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATASET TWO, has to have only below data (exclude those id's from dataset one, having description 'def')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA SET TWO should be like this&lt;BR /&gt;02 ghi&lt;BR /&gt;02 xyz&lt;BR /&gt;03 lkm&lt;BR /&gt;03 ghi&lt;BR /&gt;03 opq&lt;BR /&gt;03 rst&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 03:14:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-data/m-p/834208#M329825</guid>
      <dc:creator>West26</dc:creator>
      <dc:date>2022-09-20T03:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-data/m-p/834209#M329826</link>
      <description>&lt;P&gt;If you say "exclude those id's from dataset one, having description 'def'", isn't it the following data?&lt;BR /&gt;&lt;BR /&gt;03 lkm&lt;BR /&gt;03 ghi&lt;BR /&gt;03 opq&lt;BR /&gt;03 rst&lt;BR /&gt;04 abc&lt;BR /&gt;04 opq&lt;BR /&gt;04 xyz&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 03:26:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-data/m-p/834209#M329826</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-09-20T03:26:01Z</dc:date>
    </item>
  </channel>
</rss>

