<?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: length and &amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/length-and-quot/m-p/497620#M131947</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/234925"&gt;@clqa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;does length(“ “)=1? when do you use the length statement versus length('string')?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Length statement and Length function are different. One sets the maximum number of bytes a variable used for storage, 3 to 8 in the case of numeric variables, which may limit the precision of storage and calculations of those variables, or 1 to quite a bit longer for character variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data junk;
   x= ' ';
   y= ' d';
   z= 'd ';
   length q $ 25;
   q='';
   lx=length(x);
   ly=length(y);
   lz=length(z);
   lq=length(q);
run;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;is “ the same thing as ‘ in SAS?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In this specific case very most definitely &lt;FONT color="#ff0000"&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/FONT&gt;. Whether they occurred from typing or copy and paste neither of those actual characters are a good idea.&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="5"&gt; “    ‘ 
 "    '
&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;The top row above are the characters you typed or ended up in the post for the question. The characters used in programming are on the second row. The top row are often referred to as "smart quotes" as they look more typeset. However they will generally yield errors when used in programming. And one of the reasons we strongly recommend posting and code into the code box the forum opens with the {I} icon. The main message windows will quite often reformat text in a number of ways. Some will yield code that will not run, others change values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Sep 2018 23:35:35 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-09-20T23:35:35Z</dc:date>
    <item>
      <title>length and "</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-and-quot/m-p/497586#M131921</link>
      <description>&lt;P&gt;does length(“ “)=1? when do you use the length statement versus length('string')?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is “ the same thing as ‘ in SAS?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 22:20:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-and-quot/m-p/497586#M131921</guid>
      <dc:creator>clqa</dc:creator>
      <dc:date>2018-09-20T22:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: length and "</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-and-quot/m-p/497605#M131937</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/234925"&gt;@clqa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;does length(“ “)=1?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can find the answer by simply trying this in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;when do you use the length statement versus length('string')?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Length function tells you the length of a string; length statement sets the length of a variabel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;is “ the same thing as ‘ in SAS?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are writing macros or using macro variables or macro functions/commands, then double-quote is not the same as single-quote. Otherwise, with no macro language, double quote is the same as single-quote.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 22:53:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-and-quot/m-p/497605#M131937</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-09-20T22:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: length and "</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-and-quot/m-p/497620#M131947</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/234925"&gt;@clqa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;does length(“ “)=1? when do you use the length statement versus length('string')?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Length statement and Length function are different. One sets the maximum number of bytes a variable used for storage, 3 to 8 in the case of numeric variables, which may limit the precision of storage and calculations of those variables, or 1 to quite a bit longer for character variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data junk;
   x= ' ';
   y= ' d';
   z= 'd ';
   length q $ 25;
   q='';
   lx=length(x);
   ly=length(y);
   lz=length(z);
   lq=length(q);
run;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;is “ the same thing as ‘ in SAS?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In this specific case very most definitely &lt;FONT color="#ff0000"&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/FONT&gt;. Whether they occurred from typing or copy and paste neither of those actual characters are a good idea.&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="5"&gt; “    ‘ 
 "    '
&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;The top row above are the characters you typed or ended up in the post for the question. The characters used in programming are on the second row. The top row are often referred to as "smart quotes" as they look more typeset. However they will generally yield errors when used in programming. And one of the reasons we strongly recommend posting and code into the code box the forum opens with the {I} icon. The main message windows will quite often reformat text in a number of ways. Some will yield code that will not run, others change values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 23:35:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-and-quot/m-p/497620#M131947</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-20T23:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: length and "</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-and-quot/m-p/497621#M131948</link>
      <description>&lt;P&gt;Also look at function &lt;FONT face="courier new,courier"&gt;lengthn&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 23:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-and-quot/m-p/497621#M131948</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-09-20T23:39:28Z</dc:date>
    </item>
  </channel>
</rss>

