<?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; select short spelling when variables have numeric suffixes in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-select-short-spelling-when-variables-have-numeric/m-p/716356#M27430</link>
    <description>&lt;P&gt;PROC SQL does not handle variable lists. You can do this with a macro or through meta data, but it will not be shorter.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Feb 2021 09:58:56 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2021-02-03T09:58:56Z</dc:date>
    <item>
      <title>proc sql; select short spelling when variables have numeric suffixes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-select-short-spelling-when-variables-have-numeric/m-p/716354#M27429</link>
      <description>&lt;P&gt;Hello! I used proc sql; in my code and I was wondering how can I do a short spelling of this?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Harkonnen_0-1612345899659.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54261i4FE39495B4E0BA53/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Harkonnen_0-1612345899659.png" alt="Harkonnen_0-1612345899659.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In a data step, it will be v1-v11, but what syntaxis will be correct for SQL?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 09:54:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-sql-select-short-spelling-when-variables-have-numeric/m-p/716354#M27429</guid>
      <dc:creator>Harkonnen</dc:creator>
      <dc:date>2021-02-03T09:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql; select short spelling when variables have numeric suffixes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-select-short-spelling-when-variables-have-numeric/m-p/716356#M27430</link>
      <description>&lt;P&gt;PROC SQL does not handle variable lists. You can do this with a macro or through meta data, but it will not be shorter.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 09:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-sql-select-short-spelling-when-variables-have-numeric/m-p/716356#M27430</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-02-03T09:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql; select short spelling when variables have numeric suffixes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-select-short-spelling-when-variables-have-numeric/m-p/716423#M27436</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/337838"&gt;@Harkonnen&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In PROC SQL you can use "&lt;FONT face="courier new,courier"&gt;select *&lt;/FONT&gt;" in conjunction with KEEP= and DROP= dataset options, which support variable lists. However, you would need to check on a case-by-case basis whether an intended query can be simplified by this approach. Here's an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create test data for demonstration */

data tab_aval_rdy;
array a[*] or_p or_v or_s v1-v20 (1:23);
output;
call stdize(of a[*]);
output;
run;

data tab_chg_rdy;
array b[*] or_p or_v or_s x y z (1:6);
output;
output;
run;

/* Use "*" and variable lists in dataset options in the query */

proc sql;
create table full_tab(keep=v:) as
select a.*
from tab_aval_rdy(keep=v1-v11 or:) a left join tab_chg_rdy b
on a.or_p=b.or_p and a.or_v=b.or_v and a.or_s=b.or_s;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The same result would be obtained with the code shown in your screenshot. In this example the dataset option &lt;FONT face="courier new,courier"&gt;keep=v1-v11 or:&lt;/FONT&gt; could also be replaced by&amp;nbsp;&lt;FONT face="courier new,courier"&gt;drop=v12-v20&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 13:45:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-sql-select-short-spelling-when-variables-have-numeric/m-p/716423#M27436</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-02-03T13:45:07Z</dc:date>
    </item>
  </channel>
</rss>

