<?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: Maximum lengh of a string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lengh-of-a-string/m-p/52675#M11130</link>
    <description>I am probably going to confuse the issue but&lt;BR /&gt;
&lt;BR /&gt;
Also be carefull regarding what format is applied to the var, as if say $200. then although the length of the var is say $1024 you will only be able to "see" the first 200 chars due to the format.&lt;BR /&gt;
&lt;BR /&gt;
Barry</description>
    <pubDate>Mon, 19 Jul 2010 23:32:49 GMT</pubDate>
    <dc:creator>twocanbazza</dc:creator>
    <dc:date>2010-07-19T23:32:49Z</dc:date>
    <item>
      <title>Maximum lengh of a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lengh-of-a-string/m-p/52671#M11126</link>
      <description>I have a table created with one of the fields define as:&lt;BR /&gt;
LGC_DE 		CHAR(1024);&lt;BR /&gt;
But I read that-  The maximum length for a string variable to be passed on to SAS is 200 characters. Does this mean that my variable LGC_DE will nt hold more than 200 characters?&lt;BR /&gt;
&lt;BR /&gt;
Thank you!</description>
      <pubDate>Mon, 19 Jul 2010 17:05:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lengh-of-a-string/m-p/52671#M11126</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-19T17:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lengh of a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lengh-of-a-string/m-p/52672#M11127</link>
      <description>Hi:&lt;BR /&gt;
  For some SAS functions, the former maximum length of 200 was assumed to be the length of a character string returned by the function. However, for quite a while now, the max length of a character variable, is as stated in the documentation:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a002645858.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a002645858.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;&lt;BR /&gt;
A character variable is a variable whose value contains letters, numbers, and special characters, and whose length can be from 1 to 32,767 characters long.&lt;BR /&gt;
&lt;/B&gt;&lt;BR /&gt;
 &lt;BR /&gt;
If you need to be sure that your character variable comes across as a larger length, then use an explicit LENGTH statement:&lt;BR /&gt;
[pre]&lt;BR /&gt;
length longchar $1024;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                        &lt;BR /&gt;
There are some instances, however, where the length of a character variable is set based on interface restrictions, such as this restriction when reading from Excel:&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/19/409.html" target="_blank"&gt;http://support.sas.com/kb/19/409.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
You may need to open a track with Tech Support if you find that you have issues with the length of your character variable.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 19 Jul 2010 17:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lengh-of-a-string/m-p/52672#M11127</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-07-19T17:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lengh of a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lengh-of-a-string/m-p/52673#M11128</link>
      <description>When you say:&lt;BR /&gt;
"If you need to be sure that your character variable comes across as a larger length, then use an explicit LENGTH statement: &lt;BR /&gt;
&lt;BR /&gt;
Does it mean greater than 32767 characters?</description>
      <pubDate>Mon, 19 Jul 2010 18:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lengh-of-a-string/m-p/52673#M11128</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-19T18:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lengh of a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lengh-of-a-string/m-p/52674#M11129</link>
      <description>No, the maximum length of a string is 32767. But, consider this example of the CATX function and the use of the concatenate operator (||). By default, the concatenate operator creates the new variable with a length equal to all the concatenated pieces, while the CATX function uses a length of $200. &lt;BR /&gt;
&lt;BR /&gt;
If you want to ENSURE a length for your character variable, up to the maximum allowable length, then use the LENGTH statement, as shown in the code below.&lt;BR /&gt;
&lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data makechar;&lt;BR /&gt;
  length char2 $4000 char3 $32767 char5 $200;&lt;BR /&gt;
  ** compare the different lengths;&lt;BR /&gt;
  char1 = catx(' ','Kermit','the','Frog');&lt;BR /&gt;
  char2 = catx(' ','Kermit','the','Frog');&lt;BR /&gt;
  char3 = catx(' ','Kermit','the','Frog');&lt;BR /&gt;
  char4 = 'Kermit '||'the '||'Frog';&lt;BR /&gt;
  char5 = 'Kermit '||'the '||'Frog';&lt;BR /&gt;
run;&lt;BR /&gt;
                                    &lt;BR /&gt;
proc contents data=makechar;&lt;BR /&gt;
  title 'Compare the various lengths of the character variables';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Mon, 19 Jul 2010 20:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lengh-of-a-string/m-p/52674#M11129</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-07-19T20:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum lengh of a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Maximum-lengh-of-a-string/m-p/52675#M11130</link>
      <description>I am probably going to confuse the issue but&lt;BR /&gt;
&lt;BR /&gt;
Also be carefull regarding what format is applied to the var, as if say $200. then although the length of the var is say $1024 you will only be able to "see" the first 200 chars due to the format.&lt;BR /&gt;
&lt;BR /&gt;
Barry</description>
      <pubDate>Mon, 19 Jul 2010 23:32:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Maximum-lengh-of-a-string/m-p/52675#M11130</guid>
      <dc:creator>twocanbazza</dc:creator>
      <dc:date>2010-07-19T23:32:49Z</dc:date>
    </item>
  </channel>
</rss>

