<?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 PROC SQL: group by for n variables from a table without write list of n variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279070#M56212</link>
    <description>&lt;P&gt;Good Morning Everyone,&lt;/P&gt;&lt;P&gt;i'm writing some code for ana ETL process like that:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  create DS_OUT as 
   select t1.var1, t1.var2, ... ,  t1.varN, sum(t2.var1)
       from 
         DS_IN1 as t1
       left join 
         DS_IN2 as t2
       on (t1.var1=t2.var2)
       group by 
           t1.var1, t1.var2, ... ,  t1.varN;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;did someone know a way to make the same query but without writing after the "group by" statement all N variables? a trick?&lt;/P&gt;&lt;P&gt;i try a lot of combination, read a lot of pdf but i don't find a way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  create DS_OUT as 
   select t1.var1, t1.var2, ... ,  t1.varN, sum(t2.var1)
       from 
         DS_IN1 as t1
       left join 
         DS_IN2 as t2
       on (t1.var1=t2.var2)
       group by 
           1-N;
quit;
/*where N is the number of variables of the DS_IN1*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But I search something like "_ALL_" comand that i write for the "by" statement in proc sort when i want to sort the Dataset for all variables (i try t1._ALL_ but give ERROR: i don't find _ALL_ variables in t1 table of query or something that.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;have a nice day&lt;/P&gt;&lt;P&gt;thank you very much&lt;/P&gt;&lt;P&gt;MC&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jun 2016 15:40:37 GMT</pubDate>
    <dc:creator>MC1985</dc:creator>
    <dc:date>2016-06-21T15:40:37Z</dc:date>
    <item>
      <title>PROC SQL: group by for n variables from a table without write list of n variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279070#M56212</link>
      <description>&lt;P&gt;Good Morning Everyone,&lt;/P&gt;&lt;P&gt;i'm writing some code for ana ETL process like that:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  create DS_OUT as 
   select t1.var1, t1.var2, ... ,  t1.varN, sum(t2.var1)
       from 
         DS_IN1 as t1
       left join 
         DS_IN2 as t2
       on (t1.var1=t2.var2)
       group by 
           t1.var1, t1.var2, ... ,  t1.varN;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;did someone know a way to make the same query but without writing after the "group by" statement all N variables? a trick?&lt;/P&gt;&lt;P&gt;i try a lot of combination, read a lot of pdf but i don't find a way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  create DS_OUT as 
   select t1.var1, t1.var2, ... ,  t1.varN, sum(t2.var1)
       from 
         DS_IN1 as t1
       left join 
         DS_IN2 as t2
       on (t1.var1=t2.var2)
       group by 
           1-N;
quit;
/*where N is the number of variables of the DS_IN1*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But I search something like "_ALL_" comand that i write for the "by" statement in proc sort when i want to sort the Dataset for all variables (i try t1._ALL_ but give ERROR: i don't find _ALL_ variables in t1 table of query or something that.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;have a nice day&lt;/P&gt;&lt;P&gt;thank you very much&lt;/P&gt;&lt;P&gt;MC&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 15:40:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279070#M56212</guid>
      <dc:creator>MC1985</dc:creator>
      <dc:date>2016-06-21T15:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: group by for n variables from a table without write list of n variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279078#M56217</link>
      <description>&lt;P&gt;Unfortunately SQL does not support variable&lt;/P&gt;
&lt;P&gt;lists. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 16:04:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279078#M56217</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-21T16:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: group by for n variables from a table without write list of n variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279079#M56218</link>
      <description>&lt;P&gt;SAS variable lists are not supported by proc SQL, they would be confused with mathematical expressions. Var1-Var9 would be interpreted as the difference between Var1 and Var9. Proc SQL supports many extensions to the SQL standard (dataset options, length and format column properties, macro assignment, many SAS functions, operators such as EQT, etc.), but it cannot go astray of the standard.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 16:08:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279079#M56218</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-06-21T16:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: group by for n variables from a table without write list of n variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279249#M56261</link>
      <description>&lt;P&gt;Even if the actuasl questrion have been aswered, I justy want to a log into the fire...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When doing "regular" programming, you tend to go for as simple coding as possible, for several reasons. Easier maintenance, reducing the no of lines, flexibility etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But when it comes to ETL development, I think that many of the coding requirements are different.&lt;/P&gt;
&lt;P&gt;For ETL, auditability, traceability&amp;nbsp;and lineage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By hiding table/datas&amp;nbsp;set and column/variable names in lists or aliases makes those harder to maintain. So what feels awkward in normal programming is an asset in ETL.&lt;/P&gt;
&lt;P&gt;If you are doing "serious" ETL you should consider using an ETL tool, driven by metadata (like DI Studio does). Then you define mappings and expressions&amp;nbsp;in the UI, and the awkward SQL code will be generated for you in the background.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 09:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279249#M56261</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-06-22T09:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: group by for n variables from a table without write list of n variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279264#M56265</link>
      <description>&lt;P&gt;Hi Martino, this is the way you are looking for:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL noprint;
   SELECT 't1.'||strip(name) into :names separated by ', '
   FROM sashelp.vcolumn
   WHERE libname eq 'SASHELP' and memname eq 'CLASS'
   ;
   CREATE DS_OUT as 
      SELECT &amp;amp;names., sum(t2.var1)
      FROM DS_IN1 as t1
      LEFT JOIN DS_IN2 AS t2
      ON (t1.var1=t2.var2)
      GROUP BY &amp;amp;names.
   ;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jun 2016 10:28:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279264#M56265</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2016-06-22T10:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: group by for n variables from a table without write list of n variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279266#M56266</link>
      <description>&lt;P&gt;thanks is the second way that i used&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 10:32:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-group-by-for-n-variables-from-a-table-without-write/m-p/279266#M56266</guid>
      <dc:creator>MC1985</dc:creator>
      <dc:date>2016-06-22T10:32:25Z</dc:date>
    </item>
  </channel>
</rss>

