<?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: Proc sql , table with two dimensions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-table-with-two-dimensions/m-p/565184#M158647</link>
    <description>&lt;P&gt;thank you !&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2019 11:39:57 GMT</pubDate>
    <dc:creator>Mirou</dc:creator>
    <dc:date>2019-06-11T11:39:57Z</dc:date>
    <item>
      <title>Proc sql , table with two dimensions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-table-with-two-dimensions/m-p/564949#M158521</link>
      <description>&lt;PRE&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;i need to create this table using the sql procedure,&lt;BR /&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/30163i5DC58868D789B9B6/image-size/large?v=1.0&amp;amp;px=-1" border="0" title="ccc.GIF" alt="ccc.GIF" /&gt;&lt;BR /&gt;&lt;BR /&gt;i try to work with the sql procedure, because i couldn't calculate the ratio sum(exp_prem)/sum(exposure) using the proc tabulate,&lt;BR /&gt; proc sql ;&lt;BR /&gt; create table ss2 as &lt;BR /&gt;   select code,year&lt;BR /&gt;   sum(exposure) as exposition,&lt;BR /&gt;   sum(exp_prem)/sum(exposure)as premium,&lt;BR /&gt;group by code, year;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;so i get this table as result,&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sans titre.png" style="width: 439px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30165i5351E2C1821BE4A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sans titre.png" alt="Sans titre.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;What should i do,&lt;BR /&gt;Thank you&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 16:28:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-table-with-two-dimensions/m-p/564949#M158521</guid>
      <dc:creator>Mirou</dc:creator>
      <dc:date>2019-06-10T16:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql , table with two dimensions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-table-with-two-dimensions/m-p/564956#M158524</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/218252"&gt;@Mirou&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;i need to create this table using the sql procedure,&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ccc.GIF" style="width: 430px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30163i5DC58868D789B9B6/image-size/large?v=v2&amp;amp;px=999" role="button" title="ccc.GIF" alt="ccc.GIF" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;i try to work with the sql procedure, because i couldn't calculate the ratio sum(exp_prem)/sum(exposure) using the proc tabulate,&lt;BR /&gt; proc sql ;&lt;BR /&gt; create table ss2 as &lt;BR /&gt;   select code,year&lt;BR /&gt;   sum(exposure) as exposition,&lt;BR /&gt;   sum(exp_prem)/sum(exposure)as premium,&lt;BR /&gt;group by code, year;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;so i get this table as result,&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sans titre.png" style="width: 439px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30165i5351E2C1821BE4A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sans titre.png" alt="Sans titre.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;What should i do,&lt;BR /&gt;Thank you&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why does the report table need to be made by SQL? Either Proc Tabulate or Proc Report make such tables easy from your &lt;STRONG&gt;SS2&lt;/STRONG&gt; table.&lt;/P&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=ss2;
   class code year;
   var exposition premium;
   table code='',
         (exposition premium)* year=''* max=''*f=best8.
         /box='Code' misstext=' '
   ;
run;&lt;/PRE&gt;
&lt;P&gt;Proc Report could likely do the ratio needed but nested columns as shown might take more work in Report from the raw data.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 16:48:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-table-with-two-dimensions/m-p/564956#M158524</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-10T16:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql , table with two dimensions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-table-with-two-dimensions/m-p/565158#M158631</link>
      <description>&lt;P&gt;thanks, but how could i insert this formula into the proc tabulate, "PremuimA =sum(premuin)/sum(exposition),"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 09:33:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-table-with-two-dimensions/m-p/565158#M158631</guid>
      <dc:creator>Mirou</dc:creator>
      <dc:date>2019-06-11T09:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql , table with two dimensions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-table-with-two-dimensions/m-p/565176#M158645</link>
      <description>&lt;P&gt;Then you need PROC REPORT, using COMPUTE block.&lt;/P&gt;
&lt;P&gt;Or if you can have it pre-calculated on detail level first (using SQL), then TABULATE.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 11:09:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-table-with-two-dimensions/m-p/565176#M158645</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2019-06-11T11:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql , table with two dimensions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-table-with-two-dimensions/m-p/565184#M158647</link>
      <description>&lt;P&gt;thank you !&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 11:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-table-with-two-dimensions/m-p/565184#M158647</guid>
      <dc:creator>Mirou</dc:creator>
      <dc:date>2019-06-11T11:39:57Z</dc:date>
    </item>
  </channel>
</rss>

