<?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: Help rename Colum with pound sign or hashtag in name of Colum? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-rename-Colum-with-pound-sign-or-hashtag-in-name-of-Colum/m-p/608832#M177228</link>
    <description>&lt;P&gt;Once you set the VALIDVARNAME=ANY option you still need to use name literals when referencing names that break the normal rules.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'RM#'n&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 02 Dec 2019 19:54:22 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-12-02T19:54:22Z</dc:date>
    <item>
      <title>Help rename Colum with pound sign or hashtag in name of Colum?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-rename-Colum-with-pound-sign-or-hashtag-in-name-of-Colum/m-p/608824#M177222</link>
      <description>&lt;P&gt;Hello all,&lt;BR /&gt;I have an ODBC connection to a housing DB, one field I need has a '#' pound sign or hashtag in the field name, (no I do not know the person that designed it)&amp;nbsp; they could use a good shaking if it was legal haha... &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table testing_kmj as
select * from my_lib.my_table
where 1 = 2
;quit;
proc contents data= testing_kmj ORDER=VARNUM;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Variables in Creation Order&lt;/P&gt;
&lt;P&gt;# Variable Type Len Format Informat Label&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;6 ID Char 250 $250. $250. ID&lt;BR /&gt;&lt;STRONG&gt;7 RM#&lt;/STRONG&gt; Char 250 $250. $250. RM#&lt;BR /&gt;8 AssetType Char 250 $250. $250. AssetType&lt;BR /&gt;9 FacilityFullName Char 500 $500. $500. FacilityFullName&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, I am trying to rename it and format it to: $19. the max size I have found in all year's worth of the data set to date.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;

	create table my_new_table as
	select distinct 
		ID AS emplid format = $11. Informat=$11. length 11 label='emplid',
		Patron_SK_FK          format = 11. Informat=11. length  8 label='Patron_SK_FK',
		EffectiveDate,
		EndDate,
/*		trim(RM#) as rm_num format = $19. Informat=$19. length 19 label='rm_num',*/
		RM# as testing
		from my_lib.my_table
	;quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get this log error:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;13104 RM# as testing,&lt;BR /&gt;-&lt;BR /&gt;22&lt;BR /&gt;200&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a quoted string, !, !!, &amp;amp;, (, *, **, +, ',', -, '.', /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, AS, BETWEEN, CONTAINS, EQ, EQT, FORMAT, FROM, GE, GET, GT, GTT, IN, INFORMAT, INTO, IS, LABEL, LE, LEN,&lt;BR /&gt;LENGTH, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, TRANSCODE, ^, ^=, |, ||, ~, ~=.&lt;/P&gt;
&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I can proc print the data its all there (when I actually read in the data) as I need, it's just getting rid of the hard to use column name I want in this case.&amp;nbsp; A data step would be fine too.&lt;BR /&gt;&lt;BR /&gt;I have played around a bit with:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname = any;
options VALIDMEMNAME = extend;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;These options &amp;amp; v7 are not helping me in this case.&amp;nbsp;&amp;nbsp; PS if it helps I am using Windows10, and SAS 9.4 M3&amp;nbsp; &lt;BR /&gt;TIA -Keith&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 19:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-rename-Colum-with-pound-sign-or-hashtag-in-name-of-Colum/m-p/608824#M177222</guid>
      <dc:creator>kjohnsonm</dc:creator>
      <dc:date>2019-12-02T19:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help rename Colum with pound sign or hashtag in name of Colum?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-rename-Colum-with-pound-sign-or-hashtag-in-name-of-Colum/m-p/608832#M177228</link>
      <description>&lt;P&gt;Once you set the VALIDVARNAME=ANY option you still need to use name literals when referencing names that break the normal rules.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'RM#'n&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Dec 2019 19:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-rename-Colum-with-pound-sign-or-hashtag-in-name-of-Colum/m-p/608832#M177228</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-02T19:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help rename Colum with pound sign or hashtag in name of Colum?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-rename-Colum-with-pound-sign-or-hashtag-in-name-of-Colum/m-p/608842#M177236</link>
      <description>&lt;P&gt;If you re-import the data with the setting VALIDVARNAME=V7 it will convert RM# to RM_ which is a valid SAS name.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 20:41:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-rename-Colum-with-pound-sign-or-hashtag-in-name-of-Colum/m-p/608842#M177236</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-12-02T20:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help rename Colum with pound sign or hashtag in name of Colum?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-rename-Colum-with-pound-sign-or-hashtag-in-name-of-Colum/m-p/609026#M177294</link>
      <description>&lt;P&gt;Also try another libname option (I don't remember exactly )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;libname my_lib&amp;nbsp;db2&amp;nbsp;dsn=xxx&amp;nbsp;&amp;nbsp;preserve_col_name=yes&amp;nbsp;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 12:10:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-rename-Colum-with-pound-sign-or-hashtag-in-name-of-Colum/m-p/609026#M177294</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-12-03T12:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help rename Colum with pound sign or hashtag in name of Colum?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-rename-Colum-with-pound-sign-or-hashtag-in-name-of-Colum/m-p/609083#M177309</link>
      <description>&lt;P&gt;SASKiwi,&lt;BR /&gt;"If you re-import the data with the setting VALIDVARNAME=V7 it will convert RM# to RM_ which is a valid SAS name."&lt;BR /&gt;&lt;BR /&gt;I miss understood what this option was doing.&amp;nbsp; This is the easiest fix, what I missed was that this option 'auto' changes in my case RM# to RM_ &amp;nbsp; I thought it was making RM# a legitimate name, and then I would have to rename it.&amp;nbsp; d'oh.&amp;nbsp; Thank you.&amp;nbsp; -KJ&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 15:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-rename-Colum-with-pound-sign-or-hashtag-in-name-of-Colum/m-p/609083#M177309</guid>
      <dc:creator>kjohnsonm</dc:creator>
      <dc:date>2019-12-03T15:26:17Z</dc:date>
    </item>
  </channel>
</rss>

