<?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 How can I create a new variable that has the highest freq across variables? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469331#M70794</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create a new variable that contains the answer with the highest frequency across variables (SAS version 9.4). For example:&lt;/P&gt;&lt;P&gt;id&amp;nbsp; var&lt;/P&gt;&lt;P&gt;100 2&lt;/P&gt;&lt;P&gt;100 2&lt;/P&gt;&lt;P&gt;100 2&lt;/P&gt;&lt;P&gt;100 4&lt;/P&gt;&lt;P&gt;100 5&lt;/P&gt;&lt;P&gt;101 3&lt;/P&gt;&lt;P&gt;101 3&lt;/P&gt;&lt;P&gt;101 1&lt;/P&gt;&lt;P&gt;101 2&lt;/P&gt;&lt;P&gt;101 3&lt;/P&gt;&lt;P&gt;102 4&lt;/P&gt;&lt;P&gt;102 4&lt;/P&gt;&lt;P&gt;102 5&lt;/P&gt;&lt;P&gt;102 2&lt;/P&gt;&lt;P&gt;102 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add a new variable, so that:&lt;/P&gt;&lt;P&gt;id newvar&lt;/P&gt;&lt;P&gt;100 2&lt;/P&gt;&lt;P&gt;101 3&lt;/P&gt;&lt;P&gt;102 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems like there should be a relatively simple answer, but can't seem to figure out. I can transpose to wide if that is better. Any advice will be great, thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jun 2018 17:47:38 GMT</pubDate>
    <dc:creator>at16</dc:creator>
    <dc:date>2018-06-11T17:47:38Z</dc:date>
    <item>
      <title>How can I create a new variable that has the highest freq across variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469331#M70794</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create a new variable that contains the answer with the highest frequency across variables (SAS version 9.4). For example:&lt;/P&gt;&lt;P&gt;id&amp;nbsp; var&lt;/P&gt;&lt;P&gt;100 2&lt;/P&gt;&lt;P&gt;100 2&lt;/P&gt;&lt;P&gt;100 2&lt;/P&gt;&lt;P&gt;100 4&lt;/P&gt;&lt;P&gt;100 5&lt;/P&gt;&lt;P&gt;101 3&lt;/P&gt;&lt;P&gt;101 3&lt;/P&gt;&lt;P&gt;101 1&lt;/P&gt;&lt;P&gt;101 2&lt;/P&gt;&lt;P&gt;101 3&lt;/P&gt;&lt;P&gt;102 4&lt;/P&gt;&lt;P&gt;102 4&lt;/P&gt;&lt;P&gt;102 5&lt;/P&gt;&lt;P&gt;102 2&lt;/P&gt;&lt;P&gt;102 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add a new variable, so that:&lt;/P&gt;&lt;P&gt;id newvar&lt;/P&gt;&lt;P&gt;100 2&lt;/P&gt;&lt;P&gt;101 3&lt;/P&gt;&lt;P&gt;102 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems like there should be a relatively simple answer, but can't seem to figure out. I can transpose to wide if that is better. Any advice will be great, thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 17:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469331#M70794</guid>
      <dc:creator>at16</dc:creator>
      <dc:date>2018-06-11T17:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a new variable that has the highest freq across variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469337#M70796</link>
      <description>&lt;P&gt;ods output onewayfreqs=test;&lt;/P&gt;&lt;P&gt;proc freq data=;&lt;/P&gt;&lt;P&gt;tables var;&lt;/P&gt;&lt;P&gt;by id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=test;&lt;/P&gt;&lt;P&gt;by id descending frequency;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=test nodupkey;&lt;/P&gt;&lt;P&gt;by id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 17:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469337#M70796</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2018-06-11T17:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a new variable that has the highest freq across variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469341#M70797</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id  var;
cards;
100 2
100 2
100 2
100 4
100 5
101 3
101 3
101 1
101 2
101 3
102 4
102 4
102 5
102 2
102 1
;

proc freq data=have order=freq noprint;
by id;
tables var/out=temp(drop=percent);
run;

data want;
set temp;
by id;
if first.id;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jun 2018 18:05:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469341#M70797</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-06-11T18:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a new variable that has the highest freq across variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469344#M70798</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 18:12:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469344#M70798</guid>
      <dc:creator>at16</dc:creator>
      <dc:date>2018-06-11T18:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a new variable that has the highest freq across variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469345#M70799</link>
      <description>&lt;P&gt;Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 18:12:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469345#M70799</guid>
      <dc:creator>at16</dc:creator>
      <dc:date>2018-06-11T18:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a new variable that has the highest freq across variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469348#M70800</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/209474"&gt;@at16&lt;/a&gt;&amp;nbsp;You could mark one of the two solutions that you intend to use as accepted and close the thread.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 18:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469348#M70800</guid>
      <dc:creator>Andygray</dc:creator>
      <dc:date>2018-06-11T18:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a new variable that has the highest freq across variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469352#M70801</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/209474"&gt;@at16&lt;/a&gt;&amp;nbsp;I meant mark the one of the above &amp;nbsp;contributors who gave you the solution. lol&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 18:17:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-new-variable-that-has-the-highest-freq-across/m-p/469352#M70801</guid>
      <dc:creator>Andygray</dc:creator>
      <dc:date>2018-06-11T18:17:48Z</dc:date>
    </item>
  </channel>
</rss>

