<?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: most frequent value in SAS EG in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677207#M204352</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dlmstr=' - ';
input VehicleType $ Problem $;
datalines;
AA-Z - Motor 
AA-Z - Motor 
AA-Z - Pedal 
BB-C - Screen
BB-C - Screen
DD-F - Motor 
GG-H - Motor 
GG-H - Motor 
GG-H - Motor 
;

proc freq data=have noprint order=freq;
   tables VehicleType*Problem / out=temp(drop=percent);
run;

data want;
   set temp;
   by VehicleType notsorted;
   if first.VehicleType;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 17 Aug 2020 12:43:58 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2020-08-17T12:43:58Z</dc:date>
    <item>
      <title>most frequent value in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677190#M204347</link>
      <description>&lt;P&gt;I want to know for every vehicle how much a problem occurs. So this means a problem can occurs more than once for every vehicle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;INPUT&lt;BR /&gt;VehicleType - Problem&lt;BR /&gt;AA-Z - Motor&lt;/P&gt;
&lt;P&gt;AA-Z - Motor&lt;/P&gt;
&lt;P&gt;AA-Z - Pedal&lt;/P&gt;
&lt;P&gt;BB-C - Screen&lt;/P&gt;
&lt;P&gt;BB-C - Screen&lt;/P&gt;
&lt;P&gt;DD-F - Motor&lt;/P&gt;
&lt;P&gt;GG-H - Motor&lt;/P&gt;
&lt;P&gt;GG-H- Motor&lt;/P&gt;
&lt;P&gt;GG-H - Motor&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expected Output&lt;BR /&gt;VehicleType - Problem - CountProblem&lt;BR /&gt;AA-Z - Motor - 2&lt;/P&gt;
&lt;P&gt;BB-C -Screen - 2&lt;/P&gt;
&lt;P&gt;DD-F - Motor - 1&lt;BR /&gt;GG-H - Motor- 3&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 12:23:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677190#M204347</guid>
      <dc:creator>AK100</dc:creator>
      <dc:date>2020-08-17T12:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: most frequent value in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677194#M204348</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
  select *
  from (
    select vehicletype, problem, count(*) as countproblem
    from have
    group by vehicletype, problem
  )
  group by vehicletype
  having countproblem = max(countproblem)
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Untested, for lack of usable example data (working data step with datalines).&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 12:28:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677194#M204348</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-17T12:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: most frequent value in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677195#M204349</link>
      <description>&lt;P&gt;Are VehicleType and Problem two separate variables?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 12:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677195#M204349</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-08-17T12:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: most frequent value in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677200#M204350</link>
      <description>&lt;PRE&gt;data have;
input Vehicle $ Problem $;
cards;
AA-Z  Motor
AA-Z  Motor
AA-Z  Pedal
BB-C  Screen
BB-C  Screen
DD-F  Motor
GG-H  Motor
GG-H  Motor
GG-H  Motor
;
proc sql;
create table temp as
select vehicle,problem,count(*) as n
 from have
  group by vehicle,problem
   order by vehicle,n;
quit;
data want;
 set temp;
 by vehicle;
 if last.vehicle;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Aug 2020 12:37:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677200#M204350</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-08-17T12:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: most frequent value in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677205#M204351</link>
      <description>Thanks Kurt, this one worked good. However, what If my collumn problem is actually named Problem-Iso-2434?</description>
      <pubDate>Mon, 17 Aug 2020 12:42:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677205#M204351</guid>
      <dc:creator>AK100</dc:creator>
      <dc:date>2020-08-17T12:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: most frequent value in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677207#M204352</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dlmstr=' - ';
input VehicleType $ Problem $;
datalines;
AA-Z - Motor 
AA-Z - Motor 
AA-Z - Pedal 
BB-C - Screen
BB-C - Screen
DD-F - Motor 
GG-H - Motor 
GG-H - Motor 
GG-H - Motor 
;

proc freq data=have noprint order=freq;
   tables VehicleType*Problem / out=temp(drop=percent);
run;

data want;
   set temp;
   by VehicleType notsorted;
   if first.VehicleType;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Aug 2020 12:43:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677207#M204352</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-08-17T12:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: most frequent value in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677218#M204354</link>
      <description>&lt;P&gt;That's not a valid SAS name, so the question is moot. Even with the option of validvarname=any, &lt;STRONG&gt;YOU DO NOT USE SUCH NAMES&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fix such issues when importing data into SAS, change the hyphens to underlines.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 13:11:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/most-frequent-value-in-SAS-EG/m-p/677218#M204354</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-17T13:11:47Z</dc:date>
    </item>
  </channel>
</rss>

