<?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: Column was summary in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545575#M74314</link>
    <description>&lt;P&gt;You need to transpose to a vertical format first, then it's a breeze with proc freq:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=trans;
var pass1 pass2 pass3 pass4;
run;

proc freq data=trans;
tables col1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Untested, for lack of data.&lt;/P&gt;</description>
    <pubDate>Sun, 24 Mar 2019 07:29:54 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-03-24T07:29:54Z</dc:date>
    <item>
      <title>Column was summary</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545570#M74311</link>
      <description>&lt;P&gt;Please help !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below table in SAS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;RECORD&lt;/TD&gt;&lt;TD&gt;FIRST_PASS&lt;/TD&gt;&lt;TD&gt;SECOND_PASS&lt;/TD&gt;&lt;TD&gt;THIRD_PASS&lt;/TD&gt;&lt;TD&gt;FOURTH_PASS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;R1&lt;/TD&gt;&lt;TD&gt;R3&lt;/TD&gt;&lt;TD&gt;R4&lt;/TD&gt;&lt;TD&gt;R5&lt;/TD&gt;&lt;/TR&gt;&lt;TR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&lt;/P&gt;&lt;P&gt;Note -&lt;/P&gt;&lt;P&gt;- R1, R2 are reason for pass.&lt;/P&gt;&lt;P&gt;-&amp;nbsp;Pass Reason appears only once for each record&lt;/P&gt;</description>
      <pubDate>Sun, 24 Mar 2019 07:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545570#M74311</guid>
      <dc:creator>mohdfaisal89</dc:creator>
      <dc:date>2019-03-24T07:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Column was summary</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545572#M74312</link>
      <description>&lt;P&gt;You can't have such a table, a variable name that starts with a digit is invalid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The basic solution for such a problem is transpose and freq. For code examples, post data in usable form (data step with datalines).&lt;/P&gt;</description>
      <pubDate>Sun, 24 Mar 2019 07:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545572#M74312</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-24T07:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Column was summary</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545574#M74313</link>
      <description>&lt;P&gt;That table was just for illustration purpose. Please ignore the name convention. For understanding purpose, i wrote it as 1st .. 2nd..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can i work on an array function and count respective outcome from the array?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Mar 2019 07:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545574#M74313</guid>
      <dc:creator>mohdfaisal89</dc:creator>
      <dc:date>2019-03-24T07:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Column was summary</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545575#M74314</link>
      <description>&lt;P&gt;You need to transpose to a vertical format first, then it's a breeze with proc freq:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=trans;
var pass1 pass2 pass3 pass4;
run;

proc freq data=trans;
tables col1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Untested, for lack of data.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Mar 2019 07:29:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545575#M74314</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-24T07:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Column was summary</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545580#M74315</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;

CREATE TABLE F1 AS
select RECORD, FRIST_PASS from F1 WHERE FRIST_PASS IS NOT NULL UNION ALL 
select RECORD, SECOND_PASS from F1 WHERE SECOND_PASS IS NOT NULL UNION ALL 
select RECORD, THIRD_PASS from F1 WHERE&amp;nbsp;THIRD_PASS IS NOT NULL UNION ALL 
select RECORD, FOURTH_PASS from F1 WHERE FOURTH_PASS IS NOT NULL;

QUIT;

Proc Freq data=F1;
tables First_pass; run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This worked for me !&lt;/P&gt;</description>
      <pubDate>Sun, 24 Mar 2019 09:50:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545580#M74315</guid>
      <dc:creator>mohdfaisal89</dc:creator>
      <dc:date>2019-03-24T09:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: Column was summary</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545621#M74317</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think datastep + hash table can do&amp;nbsp; what you need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;                                                                                              
 input id p1 $ p2 $ p3 $ p4 $; 
cards4;                                                                                                 
1234 R1 R3 R4 R5                                                                                        
5678 R3 R4 R5 .                                                                                         
9101 R3 R4 R5 .                                                                                         
1112 R2 R3 R4 R5                                                                                        
;;;;                                                                                                    
run;

data _null_;
  length summary $ 8 count 8;
  declare hash H(ordered:"A");
  H.defineKey("summary");
  H.defineData("summary", "count");
  H.defineDone();
  call missing(summary, count);

  do until(eof);
    set have end = eof;
    array A p1-p4;

    do over A;
      summary = a;
      if H.find() then 
        do;
          count = 1;
          _iorc_ = H.add();
        end;
      else
        do;
          count + 1;
          _iorc_ = H.replace();
        end;
    end;
  end;

  _iorc_ = H.output(dataset:"want(where=(summary is not null))");
  stop;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 Mar 2019 19:30:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545621#M74317</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2019-03-24T19:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: Column was summary</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545688#M74322</link>
      <description>&lt;P&gt;This is exactly what i was working on.. Thanks Mate !&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2019 05:20:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Column-was-summary/m-p/545688#M74322</guid>
      <dc:creator>mohdfaisal89</dc:creator>
      <dc:date>2019-03-25T05:20:17Z</dc:date>
    </item>
  </channel>
</rss>

