<?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 Numbers as variable/column names in SAS Studio in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Numbers-as-variable-column-names-in-SAS-Studio/m-p/934022#M367331</link>
    <description>&lt;P&gt;Hello everyone, I really need some advise. I have table whose column names are numbers and I can't change this setting. Now I am trying to find a solution how to union this table with others in SAS Studio. Here's what I got so far:&lt;/P&gt;&lt;PRE&gt;options msglevel=i;
options noquotelenmax;
options validvarname=ANY; /* for variables*/  

filename genFuncs FILESRVC folderpath='/department/lib_name' filename='general_functions_v2.sas';
%include genFuncs / source;

proc cas;
  %casFunctions;
  
  outCaslibName="lib_name";
  casTableName="table_union";
  tmpTableName = casTableName || "_" || rand("Integer", 111111, 999999);

  createTableString="create table lib_name." || tmpTableName ||" {options replace=true} as (

 &lt;STRONG&gt;select v.month from lib_name.normal_table v
 union all
 select t.'198'n from lib_name.uqly_table t&lt;/STRONG&gt;
  )";&lt;/PRE&gt;&lt;P&gt;and I can't convince SAS, that '198'n is the month column name.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error" style="width: 360px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97961i7101EC5E2026873F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Snímek obrazovky 2024-06-28 120315.png" alt="error" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;error&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2024 10:04:32 GMT</pubDate>
    <dc:creator>emptyhead</dc:creator>
    <dc:date>2024-06-28T10:04:32Z</dc:date>
    <item>
      <title>Numbers as variable/column names in SAS Studio</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numbers-as-variable-column-names-in-SAS-Studio/m-p/934022#M367331</link>
      <description>&lt;P&gt;Hello everyone, I really need some advise. I have table whose column names are numbers and I can't change this setting. Now I am trying to find a solution how to union this table with others in SAS Studio. Here's what I got so far:&lt;/P&gt;&lt;PRE&gt;options msglevel=i;
options noquotelenmax;
options validvarname=ANY; /* for variables*/  

filename genFuncs FILESRVC folderpath='/department/lib_name' filename='general_functions_v2.sas';
%include genFuncs / source;

proc cas;
  %casFunctions;
  
  outCaslibName="lib_name";
  casTableName="table_union";
  tmpTableName = casTableName || "_" || rand("Integer", 111111, 999999);

  createTableString="create table lib_name." || tmpTableName ||" {options replace=true} as (

 &lt;STRONG&gt;select v.month from lib_name.normal_table v
 union all
 select t.'198'n from lib_name.uqly_table t&lt;/STRONG&gt;
  )";&lt;/PRE&gt;&lt;P&gt;and I can't convince SAS, that '198'n is the month column name.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error" style="width: 360px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97961i7101EC5E2026873F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Snímek obrazovky 2024-06-28 120315.png" alt="error" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;error&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 10:04:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numbers-as-variable-column-names-in-SAS-Studio/m-p/934022#M367331</guid>
      <dc:creator>emptyhead</dc:creator>
      <dc:date>2024-06-28T10:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers as variable/column names in SAS Studio</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numbers-as-variable-column-names-in-SAS-Studio/m-p/934038#M367334</link>
      <description>&lt;P&gt;I do not use CAS language, but it looks to me like you are creating a character variable that happens to contain what looks like SQL syntax.&amp;nbsp; &amp;nbsp;If it is just a string then the content shouldn't matter.&amp;nbsp; So somewhere under the hood the string must have been used by some SQL process.&amp;nbsp; Perhaps that SQL process would rather that you use ANSI style double quotes around invalid names?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;createTableString
   ="create table lib_name." || tmpTableName
  ||" {options replace=true} as ("
  ||"select v.month from lib_name.normal_table v "
  ||" union all "
  ||"select t.""198"" from lib_name.uqly_table t"
  ||")"
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jun 2024 11:43:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numbers-as-variable-column-names-in-SAS-Studio/m-p/934038#M367334</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-06-28T11:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers as variable/column names in SAS Studio</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numbers-as-variable-column-names-in-SAS-Studio/m-p/934039#M367335</link>
      <description>&lt;P&gt;Fix the process that creates the ugly table, so you don't have to deal with those stupid name literals.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 11:55:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numbers-as-variable-column-names-in-SAS-Studio/m-p/934039#M367335</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-06-28T11:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Numbers as variable/column names in SAS Studio</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numbers-as-variable-column-names-in-SAS-Studio/m-p/934044#M367336</link>
      <description>&lt;P&gt;Thousand thanks, it works!&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 12:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numbers-as-variable-column-names-in-SAS-Studio/m-p/934044#M367336</guid>
      <dc:creator>emptyhead</dc:creator>
      <dc:date>2024-06-28T12:14:38Z</dc:date>
    </item>
  </channel>
</rss>

