<?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: How can I get the below result with following data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889860#M351596</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/447900"&gt;@Vimal1010&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So basically, if common value is there related to an ID then that value should be there with distinct ID in output table, similarly if different values are there for an ID then in output Hybrid should be published with that&amp;nbsp;distinct ID.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Thank you.&amp;nbsp; I think this code does what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=_:);
  set have;
  by id value notsorted;
  if first.id then _nvalue=1;
  else if first.value then _nvalue+1;
  if last.id;
  if _nvalue&amp;gt;1 then value='Hybrid';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 18 Aug 2023 13:17:28 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2023-08-18T13:17:28Z</dc:date>
    <item>
      <title>How can I get the below result with following data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889839#M351591</link>
      <description>&lt;P&gt;Please help me to get the below output from the input data using SAS datastep or proc sql:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Input Data:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID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t;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Others&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;Hybrid&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Others&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 12:25:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889839#M351591</guid>
      <dc:creator>Vimal1010</dc:creator>
      <dc:date>2023-08-18T12:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the below result with following data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889849#M351592</link>
      <description>&lt;P&gt;I have a good idea of how you might do this, but you have not specified the rule you wish to use to generate the displayed output from the sample input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please state the rule you want to apply - which of course is the first step in generating appropriate SAS code.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 12:56:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889849#M351592</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2023-08-18T12:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the below result with following data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889852#M351593</link>
      <description>&lt;P&gt;So basically, if common value is there related to an ID then that value should be there with distinct ID in output table, similarly if different values are there for an ID then in output Hybrid should be published with that&amp;nbsp;distinct ID.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 13:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889852#M351593</guid>
      <dc:creator>Vimal1010</dc:creator>
      <dc:date>2023-08-18T13:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the below result with following data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889854#M351594</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
do until (last.id);
  set have;
  by id;
  if value ne lag(value) and not first.id then flag = 1;
end;
if flag then value = "Hybrid";
drop flag;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Aug 2023 13:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889854#M351594</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-08-18T13:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the below result with following data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889860#M351596</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/447900"&gt;@Vimal1010&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So basically, if common value is there related to an ID then that value should be there with distinct ID in output table, similarly if different values are there for an ID then in output Hybrid should be published with that&amp;nbsp;distinct ID.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Thank you.&amp;nbsp; I think this code does what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=_:);
  set have;
  by id value notsorted;
  if first.id then _nvalue=1;
  else if first.value then _nvalue+1;
  if last.id;
  if _nvalue&amp;gt;1 then value='Hybrid';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Aug 2023 13:17:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889860#M351596</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2023-08-18T13:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the below result with following data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889868#M351599</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 13:29:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-get-the-below-result-with-following-data/m-p/889868#M351599</guid>
      <dc:creator>Vimal1010</dc:creator>
      <dc:date>2023-08-18T13:29:45Z</dc:date>
    </item>
  </channel>
</rss>

