<?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: Identifying multiple possibilities in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448349#M283460</link>
    <description>&lt;P&gt;Is the variable assigned a value of 1 because name and name2 are different or because you have more than one value of name2 for each value of name? Those are two different rules that would result in the shown desired result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And for some completeness sake, what would the result be for this data if it were part of your example data?&lt;/P&gt;
&lt;P&gt;1 Highland Highland&amp;nbsp;&amp;nbsp;&amp;nbsp; 2008&lt;/P&gt;</description>
    <pubDate>Fri, 23 Mar 2018 21:55:11 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-23T21:55:11Z</dc:date>
    <item>
      <title>Identifying multiple possibilities</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448320#M283455</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to identify observations having multiple options (Name -&amp;gt; Name2).&lt;/P&gt;&lt;P&gt;Here is my data like...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data test;&lt;/P&gt;&lt;P&gt;input ID NAME $ NAME2 $ Year;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 Highland HighlandBell 2008&lt;/P&gt;&lt;P&gt;1 Highland HighlandBell 2009&lt;/P&gt;&lt;P&gt;1 Highland HighlandBell 2010&lt;/P&gt;&lt;P&gt;1 Highland HighlandCorp 2008&lt;/P&gt;&lt;P&gt;1 Highland HighlandCorp 2009&lt;/P&gt;&lt;P&gt;1 Highland HighlandCorp 2010&lt;/P&gt;&lt;P&gt;1 Highland HighlandMalt 2008&lt;/P&gt;&lt;P&gt;1 Highland HighlandMalt 2009&lt;/P&gt;&lt;P&gt;1 Highland HighlandMalt 2010&lt;/P&gt;&lt;P&gt;2 HillBrosINC HillBrosINC 2011&lt;/P&gt;&lt;P&gt;2 HillBrosINC HillBrosINC 2012&lt;/P&gt;&lt;P&gt;3 HitachiLTD HitachLTD 2008&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I want to create one additional column to the dataset. Like..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data test;&lt;/P&gt;&lt;P&gt;input ID NAME $ NAME2 $ Year Want;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 Highland HighlandBell 2008 1&lt;/P&gt;&lt;P&gt;1 Highland HighlandBell 2009 1&lt;/P&gt;&lt;P&gt;1 Highland HighlandBell 2010 1&lt;/P&gt;&lt;P&gt;1 Highland HighlandCorp 2008 1&lt;/P&gt;&lt;P&gt;1 Highland HighlandCorp 2009 1&lt;/P&gt;&lt;P&gt;1 Highland HighlandCorp 2010 1&lt;/P&gt;&lt;P&gt;1 Highland HighlandMalt 2008 1&lt;/P&gt;&lt;P&gt;1 Highland HighlandMalt 2009 1&lt;/P&gt;&lt;P&gt;1 Highland HighlandMalt 2010 1&lt;/P&gt;&lt;P&gt;2 HillBrosINC HillBrosINC 2011 0&lt;/P&gt;&lt;P&gt;2 HillBrosINC HillBrosINC 2012 0&lt;/P&gt;&lt;P&gt;3 HitachiLTD HitachLTD 2008 0&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 20:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448320#M283455</guid>
      <dc:creator>hkim3677</dc:creator>
      <dc:date>2018-03-23T20:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple possibilities</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448321#M283456</link>
      <description>&lt;P&gt;Are there rules for that column? How are you calculating it?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 20:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448321#M283456</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-23T20:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple possibilities</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448330#M283457</link>
      <description>&lt;P&gt;What is the role of year?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 20:58:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448330#M283457</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-23T20:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple possibilities</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448344#M283458</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test;

input ID NAME :$30. NAME2  :$30. Year;

datalines;
1 Highland HighlandBell 2008
1 Highland HighlandBell 2009
1 Highland HighlandBell 2010
1 Highland HighlandCorp 2008
1 Highland HighlandCorp 2009
1 Highland HighlandCorp 2010
1 Highland HighlandMalt 2008
1 Highland HighlandMalt 2009
1 Highland HighlandMalt 2010
2 HillBrosINC HillBrosINC 2011
2 HillBrosINC HillBrosINC 2012
3 HitachiLTD HitachLTD 2008

;

run;

data want;
do until(last.id);
f=0;
do until(last.name);
set test;
by id name name2;
if lag(name2) ne name2 then f+1;
end;
end;
do until(last.id);
set test;
by id name name2;;
Want=f&amp;gt;1;
output;
end;
drop f;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Mar 2018 21:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448344#M283458</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-23T21:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple possibilities</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448348#M283459</link>
      <description>&lt;P&gt;The Want column indicates whether the "Name" has multiple matching in "Name2".&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 21:54:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448348#M283459</guid>
      <dc:creator>hkim3677</dc:creator>
      <dc:date>2018-03-23T21:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple possibilities</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448349#M283460</link>
      <description>&lt;P&gt;Is the variable assigned a value of 1 because name and name2 are different or because you have more than one value of name2 for each value of name? Those are two different rules that would result in the shown desired result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And for some completeness sake, what would the result be for this data if it were part of your example data?&lt;/P&gt;
&lt;P&gt;1 Highland Highland&amp;nbsp;&amp;nbsp;&amp;nbsp; 2008&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 21:55:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448349#M283460</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-23T21:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple possibilities</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448350#M283461</link>
      <description>Actually, there is no rule of year. They are just given to show multiple matches across years.</description>
      <pubDate>Fri, 23 Mar 2018 21:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448350#M283461</guid>
      <dc:creator>hkim3677</dc:creator>
      <dc:date>2018-03-23T21:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple possibilities</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448353#M283462</link>
      <description>&lt;P&gt;Then you just need a simple query:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test;
input ID NAME :$16. NAME2 :$16. Year;
datalines;
1 Highland HighlandBell 2008
1 Highland HighlandBell 2009
1 Highland HighlandBell 2010
1 Highland HighlandCorp 2008
1 Highland HighlandCorp 2009
1 Highland HighlandCorp 2010
1 Highland HighlandMalt 2008
1 Highland HighlandMalt 2009
1 Highland HighlandMalt 2010
2 HillBrosINC HillBrosINC 2011
2 HillBrosINC HillBrosINC 2012
3 HitachiLTD HitachLTD 2008
;
proc sql;
create table test2 as
select *, count(distinct name2) &amp;gt; 1 as want
from test
group by name;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Mar 2018 22:03:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448353#M283462</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-23T22:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple possibilities</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448414#M283463</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test;
input ID NAME :$16. NAME2 :$16. Year;
datalines;
1 Highland HighlandBell 2008
1 Highland HighlandBell 2009
1 Highland HighlandBell 2010
1 Highland HighlandCorp 2008
1 Highland HighlandCorp 2009
1 Highland HighlandCorp 2010
1 Highland HighlandMalt 2008
1 Highland HighlandMalt 2009
1 Highland HighlandMalt 2010
2 HillBrosINC HillBrosINC 2011
2 HillBrosINC HillBrosINC 2012
3 HitachiLTD HitachLTD 2008
;
proc sql;
create table test2 as
select *,case when count(distinct catx(' ',name,name2)) ne 1 then 1
         else 0 end as want
from test
group by name;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Mar 2018 10:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-multiple-possibilities/m-p/448414#M283463</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-24T10:36:22Z</dc:date>
    </item>
  </channel>
</rss>

