<?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: Summarization Help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591372#M169380</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287480"&gt;@anweinbe&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;At any rate, you'll need 2 passes through the data regardless of the method you choose. Below, the first pass is used to find the distinct names of the output summary variables for each [Company,Year]; then the second pass is used to aggregate directly into the output format you need.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;                                                                                                                             
  input Company :$16. Year Country:$16. Code Total ;                                                                                    
  cards ;                                                                                                                               
Amazon  2004  USA        1  100                                                                                                         
Amazon  2004  USA        1  142                                                                                                         
Amazon  2003  USA        2  172                                                                                                         
Amazon  2004  USA        2  178                                                                                                         
Amazon  2006  USA        1  158                                                                                                         
Amazon  2003  USA        3  177                                                                                                         
Amazon  2005  Argentina  4  146                                                                                                         
Amazon  2004  Cuba       3  182                                                                                                         
Amazon  2005  England    2  188                                                                                                         
Amazon  2006  France     1  110                                                                                                         
Amazon  2005  Canada     4  176                                                                                                         
Amazon  2005  Mexico     3  113                                                                                                         
Sony    2003  USA        2  184                                                                                                         
Sony    2003  USA        1  148                                                                                                         
Sony    2003  USA        3  177                                                                                                         
Sony    2005  USA        2  178                                                                                                         
Sony    2006  USA        1  184                                                                                                         
Sony    2005  Argentina  2  122                                                                                                         
Sony    2006  Cuba       4  129                                                                                                         
Sony    2006  England    2  109                                                                                                         
Sony    2003  France     3  103                                                                                                         
Sony    2004  Canada     3  158                                                                                                         
Sony    2005  Mexico     1  187                                                                                                         
;                                                                                                                                       
run ;                                                                                                                                   
                                                                                                                                        
%let dfc_expr = catx ("_", ifc (country="USA", "Domestic", "Foreign"), cats ("Code", code)) ;                                           
                                                                                                                                        
proc sql noprint ;                                                                                                                      
  select distinct &amp;amp;dfc_expr into :dfc separated by " " from have ;                                                                      
quit ;                                                                                                                                  
                                                                                                                                        
data _null_ ;                                                                                                                           
  if _n_ = 1 then do ;                                                                                                                  
    array ss &amp;amp;dfc ;                                                                                                                     
    dcl hash h (ordered:"a") ;                                                                                                          
    h.definekey  ("company", "year") ;                                                                                                  
    h.definedata ("company", "year") ;                                                                                                  
    do over ss ;                                                                                                                        
      h.definedata (vname (ss)) ;                                                                                                       
    end ;                                                                                                                               
    h.definedone() ;                                                                                                                    
  end ;                                                                                                                                 
  set have end = end ;                                                                                                                  
  if h.find() ne 0 then call missing (of ss[*]) ;                                                                                       
  do over ss ;                                                                                                                          
    if vname (ss) ne &amp;amp;dfc_expr then continue ;                                                                                          
    ss ++ total ;                                                                                                                       
    leave ;                                                                                                                             
  end ;                                                                                                                                 
  h.replace() ;                                                                                                                         
  if end then h.output (dataset:"want") ;                                                                                               
run ;                                              
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that the names of the summary variables are created in the pattern of Domestic_Code1, Foreign_Code2, and so forth. You can change it to your liking by changing the expression assigned to the macro variable DFC_EXPR. Also note that if some combination of Company, Year, and DFC is not in the input data, you'll get a missing value in that cell. If you want it to be a zero, change the code line with CALL MISSING to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  if h.find() ne 0 then do over ss ;                                                                                                    
    ss = 0 ;                                                                                                                            
  end ;     
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Sep 2019 03:39:26 GMT</pubDate>
    <dc:creator>hashman</dc:creator>
    <dc:date>2019-09-25T03:39:26Z</dc:date>
    <item>
      <title>Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591335#M169362</link>
      <description>&lt;DIV class="lia-message-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;Good evening SAS community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am very new to SAS and would love some help on developing some code. I'm sure this might be very simple for anyone with experience and I thank everyone in advance for sharing the knowledge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a file that is broken out by company, year, country, product code and total sales. I created a very simple dummy file of what my real data looks like below. In short, I am trying to summarize the file so I get output for each company by year that shows me the total total sales that were in the US by company and that were outside of the US by company.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would love the output to look like something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Company&lt;/TD&gt;&lt;TD&gt;Year&lt;/TD&gt;&lt;TD&gt;Domestic - code1&lt;/TD&gt;&lt;TD&gt;Domestic - code2&lt;/TD&gt;&lt;TD&gt;Domestic - Code 3&lt;/TD&gt;&lt;TD&gt;Foreign - Code 1&lt;/TD&gt;&lt;TD&gt;Foreign - Code 2&lt;/TD&gt;&lt;TD&gt;Foreign - Code 3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;amazon&lt;/TD&gt;&lt;TD&gt;2003&lt;/TD&gt;&lt;TD&gt;4053&lt;/TD&gt;&lt;TD&gt;39438&lt;/TD&gt;&lt;TD&gt;3438&lt;/TD&gt;&lt;TD&gt;39492&lt;/TD&gt;&lt;TD&gt;8382&lt;/TD&gt;&lt;TD&gt;83292&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;&lt;P&gt;Here is what my data looks like. I included it in excel too in case that is more helpful!&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0" border="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Company&lt;/TD&gt;&lt;TD&gt;Year&lt;/TD&gt;&lt;TD&gt;Country&lt;/TD&gt;&lt;TD&gt;Code&lt;/TD&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Amazon&lt;/TD&gt;&lt;TD&gt;2004&lt;/TD&gt;&lt;TD&gt;USA&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;142&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Amazon&lt;/TD&gt;&lt;TD&gt;2003&lt;/TD&gt;&lt;TD&gt;USA&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;172&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Amazon&lt;/TD&gt;&lt;TD&gt;2004&lt;/TD&gt;&lt;TD&gt;USA&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;178&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Amazon&lt;/TD&gt;&lt;TD&gt;2006&lt;/TD&gt;&lt;TD&gt;USA&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;158&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Amazon&lt;/TD&gt;&lt;TD&gt;2003&lt;/TD&gt;&lt;TD&gt;USA&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;177&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Amazon&lt;/TD&gt;&lt;TD&gt;2005&lt;/TD&gt;&lt;TD&gt;Argentina&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt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;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sony&lt;/TD&gt;&lt;TD&gt;2005&lt;/TD&gt;&lt;TD&gt;Mexico&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;187&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 24 Sep 2019 23:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591335#M169362</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2019-09-24T23:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591338#M169364</link>
      <description>&lt;P&gt;proc transpose will do that trick.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 00:31:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591338#M169364</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-09-25T00:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591372#M169380</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287480"&gt;@anweinbe&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;At any rate, you'll need 2 passes through the data regardless of the method you choose. Below, the first pass is used to find the distinct names of the output summary variables for each [Company,Year]; then the second pass is used to aggregate directly into the output format you need.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;                                                                                                                             
  input Company :$16. Year Country:$16. Code Total ;                                                                                    
  cards ;                                                                                                                               
Amazon  2004  USA        1  100                                                                                                         
Amazon  2004  USA        1  142                                                                                                         
Amazon  2003  USA        2  172                                                                                                         
Amazon  2004  USA        2  178                                                                                                         
Amazon  2006  USA        1  158                                                                                                         
Amazon  2003  USA        3  177                                                                                                         
Amazon  2005  Argentina  4  146                                                                                                         
Amazon  2004  Cuba       3  182                                                                                                         
Amazon  2005  England    2  188                                                                                                         
Amazon  2006  France     1  110                                                                                                         
Amazon  2005  Canada     4  176                                                                                                         
Amazon  2005  Mexico     3  113                                                                                                         
Sony    2003  USA        2  184                                                                                                         
Sony    2003  USA        1  148                                                                                                         
Sony    2003  USA        3  177                                                                                                         
Sony    2005  USA        2  178                                                                                                         
Sony    2006  USA        1  184                                                                                                         
Sony    2005  Argentina  2  122                                                                                                         
Sony    2006  Cuba       4  129                                                                                                         
Sony    2006  England    2  109                                                                                                         
Sony    2003  France     3  103                                                                                                         
Sony    2004  Canada     3  158                                                                                                         
Sony    2005  Mexico     1  187                                                                                                         
;                                                                                                                                       
run ;                                                                                                                                   
                                                                                                                                        
%let dfc_expr = catx ("_", ifc (country="USA", "Domestic", "Foreign"), cats ("Code", code)) ;                                           
                                                                                                                                        
proc sql noprint ;                                                                                                                      
  select distinct &amp;amp;dfc_expr into :dfc separated by " " from have ;                                                                      
quit ;                                                                                                                                  
                                                                                                                                        
data _null_ ;                                                                                                                           
  if _n_ = 1 then do ;                                                                                                                  
    array ss &amp;amp;dfc ;                                                                                                                     
    dcl hash h (ordered:"a") ;                                                                                                          
    h.definekey  ("company", "year") ;                                                                                                  
    h.definedata ("company", "year") ;                                                                                                  
    do over ss ;                                                                                                                        
      h.definedata (vname (ss)) ;                                                                                                       
    end ;                                                                                                                               
    h.definedone() ;                                                                                                                    
  end ;                                                                                                                                 
  set have end = end ;                                                                                                                  
  if h.find() ne 0 then call missing (of ss[*]) ;                                                                                       
  do over ss ;                                                                                                                          
    if vname (ss) ne &amp;amp;dfc_expr then continue ;                                                                                          
    ss ++ total ;                                                                                                                       
    leave ;                                                                                                                             
  end ;                                                                                                                                 
  h.replace() ;                                                                                                                         
  if end then h.output (dataset:"want") ;                                                                                               
run ;                                              
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that the names of the summary variables are created in the pattern of Domestic_Code1, Foreign_Code2, and so forth. You can change it to your liking by changing the expression assigned to the macro variable DFC_EXPR. Also note that if some combination of Company, Year, and DFC is not in the input data, you'll get a missing value in that cell. If you want it to be a zero, change the code line with CALL MISSING to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  if h.find() ne 0 then do over ss ;                                                                                                    
    ss = 0 ;                                                                                                                            
  end ;     
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 03:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591372#M169380</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-09-25T03:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591454#M169421</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* UNTESTED CODE */

data have2;
    set have;
    length type $ 24;
    if country='USA' then type=cats('Domestic-',code);
    else type=cats('Foreign-',code);
run;
proc report data=have2;
    columns company year type,total;
    define company/group;
    define year/group;
    define type/across;
    define total/analysis sum;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Sep 2019 10:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591454#M169421</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-25T10:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591474#M169427</link>
      <description>&lt;P&gt;Paige,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you kindly! This appeared to do the trick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One followup.... is there a way to take the company name and fill it for each record so I can see "amazon" next to each firm year?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; type&amp;nbsp; Domestic-1 Domestic-2 Domestic-3 Foreign-1 Foreign-2 Foreign-3 Foreign-4Company Year Total Total Total Total Total Total Total&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Amazon&lt;/TD&gt;&lt;TD&gt;2003&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;168&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;163&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2004&lt;/TD&gt;&lt;TD&gt;194&lt;/TD&gt;&lt;TD&gt;164&lt;/TD&gt;&lt;TD&gt;165&lt;/TD&gt;&lt;TD&gt;158&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;332&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2006&lt;/TD&gt;&lt;TD&gt;166&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;145&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 25 Sep 2019 12:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591474#M169427</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2019-09-25T12:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591478#M169430</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287480"&gt;@anweinbe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;One followup.... is there a way to take the company name and fill it for each record so I can see "amazon" next to each firm year?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not easily, as far as I know. Probably would involve PROC SUMMARY and PROC TRANSPOSE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want an output data set, or a printed/viewed report?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 12:25:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591478#M169430</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-25T12:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591486#M169435</link>
      <description>&lt;P&gt;Ideally I plan to have it in an output file that can be brought into SPSS&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 12:40:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591486#M169435</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2019-09-25T12:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591487#M169436</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287480"&gt;@anweinbe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Ideally I plan to have it in an output file that can be brought into SPSS&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't know what this means, your choices are to save the results in a SAS data set, or some printed/saved output file. Please specify one of the two.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 12:46:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591487#M169436</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-25T12:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591509#M169450</link>
      <description>&lt;P&gt;A SAS dataset will be perfect &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 13:21:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591509#M169450</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2019-09-25T13:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591514#M169455</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287480"&gt;@anweinbe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;A SAS dataset will be perfect &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do the variable names matter? What should they be?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 13:30:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591514#M169455</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-25T13:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591515#M169456</link>
      <description>I would like them to be easily understood. Exact names do not matter in most cases. It would be great for example if the company name did say “company”.&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Sep 2019 13:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591515#M169456</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2019-09-25T13:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Summarization Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591516#M169457</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287480"&gt;@anweinbe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I would like them to be easily understood. Exact names do not matter in most cases. It would be great for example if the company name did say “company”.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It looks like you should do this via PROC SUMMARY and PROC TRANSPOSE&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have2 nway;
    class company year type;
    var total;
    output out=sums sum=;
run;

proc transpose data=sums out=want;
   by company year;
   var total;
   id type;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Sep 2019 13:37:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Summarization-Help/m-p/591516#M169457</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-25T13:37:00Z</dc:date>
    </item>
  </channel>
</rss>

