<?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: How to define length for char variable where the variable name contains special character like + in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-define-length-for-char-variable-where-the-variable-name/m-p/694775#M211910</link>
    <description>Thank you so much...Sorted it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Wed, 28 Oct 2020 09:32:43 GMT</pubDate>
    <dc:creator>Jannet</dc:creator>
    <dc:date>2020-10-28T09:32:43Z</dc:date>
    <item>
      <title>How to define length for char variable where the variable name contains special character like +</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-define-length-for-char-variable-where-the-variable-name/m-p/694768#M211906</link>
      <description>&lt;P&gt;How to define length in data step for char variable where the variable name contains special character '+' ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to concatenate two datasets (A and B). When i try doing, the values in DTH + RB variables gets truncated due to different length of the variable in two datasets. Hence, I am trying to define the length for variable DTH + RB while concatenating but because of the special character in the variable DTH + RB the below codes are not working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please suggest how to handle this special characters which are in variable names?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eg: A dataset&lt;/P&gt;&lt;P&gt;ID DTH + RB&lt;/P&gt;&lt;P&gt;1&amp;nbsp; a&lt;/P&gt;&lt;P&gt;2&amp;nbsp; abc&lt;/P&gt;&lt;P&gt;3 jeremiahpaul&lt;/P&gt;&lt;P&gt;4 58&lt;/P&gt;&lt;P&gt;5 99&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eg: B dataset&lt;/P&gt;&lt;P&gt;ID DTH + RB&lt;/P&gt;&lt;P&gt;1&amp;nbsp; ab&lt;/P&gt;&lt;P&gt;2&amp;nbsp; abcd&lt;/P&gt;&lt;P&gt;3 jerereremhihahdjh&lt;/P&gt;&lt;P&gt;4 58&lt;/P&gt;&lt;P&gt;5 99&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i try the below code, sas separates the DTH and RB as different column&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ex;&lt;/P&gt;&lt;P&gt;length&amp;nbsp;DTH + RB $17.;&lt;/P&gt;&lt;P&gt;set A B;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 09:18:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-define-length-for-char-variable-where-the-variable-name/m-p/694768#M211906</guid>
      <dc:creator>Jannet</dc:creator>
      <dc:date>2020-10-28T09:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to define length for char variable where the variable name contains special character like +</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-define-length-for-char-variable-where-the-variable-name/m-p/694771#M211907</link>
      <description>&lt;P&gt;Under the option VALIDVARNAME=ANY, you can use (almost) any characters in variable names, but you need to use so-called "name literals" to address those variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length 'DTH + RB'n $17.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But it is preferred to rename such variables to valid SAS names like dth_plus_rb, as these are much easier to use in &amp;nbsp;further coding:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ex;
length 'DTH + RB' $17.;
set A B;
rename 'DTH + RB'=dth_plus_rb;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Oct 2020 09:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-define-length-for-char-variable-where-the-variable-name/m-p/694771#M211907</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-28T09:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to define length for char variable where the variable name contains special character like +</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-define-length-for-char-variable-where-the-variable-name/m-p/694772#M211908</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not a valid SAS variable name. SAS has an option to deal with non valid variables&lt;/P&gt;
&lt;P&gt;names but the best solution would be to rename your column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lesysoptsref&amp;amp;docsetTarget=p124dqdk8zoqu3n1r4nsfqu5vx52.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lesysoptsref&amp;amp;docsetTarget=p124dqdk8zoqu3n1r4nsfqu5vx52.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not tested :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;

data ex;
    length 'DTH + RB'n $17.;
    set A B;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 09:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-define-length-for-char-variable-where-the-variable-name/m-p/694772#M211908</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2020-10-28T09:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to define length for char variable where the variable name contains special character like +</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-define-length-for-char-variable-where-the-variable-name/m-p/694774#M211909</link>
      <description>Thank you so much ...I really appreciate ur time</description>
      <pubDate>Wed, 28 Oct 2020 09:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-define-length-for-char-variable-where-the-variable-name/m-p/694774#M211909</guid>
      <dc:creator>Jannet</dc:creator>
      <dc:date>2020-10-28T09:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to define length for char variable where the variable name contains special character like +</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-define-length-for-char-variable-where-the-variable-name/m-p/694775#M211910</link>
      <description>Thank you so much...Sorted it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 28 Oct 2020 09:32:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-define-length-for-char-variable-where-the-variable-name/m-p/694775#M211910</guid>
      <dc:creator>Jannet</dc:creator>
      <dc:date>2020-10-28T09:32:43Z</dc:date>
    </item>
  </channel>
</rss>

