<?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 with quoted data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54528#M11558</link>
    <description>Ok I get your point seems like I have refer to macro documentation and update my understanding &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Tue, 09 Feb 2010 15:14:58 GMT</pubDate>
    <dc:creator>VAMA</dc:creator>
    <dc:date>2010-02-09T15:14:58Z</dc:date>
    <item>
      <title>%length with quoted data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54522#M11552</link>
      <description>Hi,&lt;BR /&gt;
I am confused with behaviour of %LENGTH function, here is example to explain&lt;BR /&gt;
%let line=%nrbquote(a;b;c);&lt;BR /&gt;
%let line_length=%length(%sysfunc(tranwrd(&amp;amp;line,%str(a),%str(k))));&lt;BR /&gt;
&lt;BR /&gt;
Since %sysfunc unquotes result I was expecting %length function would give error but it did not. Can someone explain why I am not getting any error?</description>
      <pubDate>Tue, 09 Feb 2010 12:46:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54522#M11552</guid>
      <dc:creator>VAMA</dc:creator>
      <dc:date>2010-02-09T12:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: %length with quoted data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54523#M11553</link>
      <description>The SAS macro compiler was not invoked with your "open" SAS code statements.  Wrap your code within a macro and the error occurs because of the imbedded semi-colon in the first %LET for macro variable LINE.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 09 Feb 2010 13:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54523#M11553</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-02-09T13:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: %length with quoted data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54524#M11554</link>
      <description>Thanks yes you are correct however I do not full understand:  %sysfunc and %length are executed in macro execution and not on macro comiplation, so why does open code make difference?</description>
      <pubDate>Tue, 09 Feb 2010 13:39:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54524#M11554</guid>
      <dc:creator>VAMA</dc:creator>
      <dc:date>2010-02-09T13:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: %length with quoted data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54525#M11555</link>
      <description>The SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website's SEARCH facility can turn you on to much about the macro variable and macro variables.&lt;BR /&gt;
&lt;BR /&gt;
Also, recommend starting here...&lt;BR /&gt;
&lt;BR /&gt;
SAS Macro Language: Introduction to the Macro Facility&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a002293969.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a002293969.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 09 Feb 2010 13:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54525#M11555</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-02-09T13:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: %length with quoted data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54526#M11556</link>
      <description>I have already read these documents ..when you replied back i was qick to copy open code in macro and it gave error - however i realized it was giving error because I forgot to put semi-colons in %str i.e.&lt;BR /&gt;
&lt;BR /&gt;
%macro temp;&lt;BR /&gt;
%let line=%nrbquote(a%str(;)b%str(;)c);&lt;BR /&gt;
%let line_length=%length(%sysfunc(tranwrd(&amp;amp;line,%str(a),%str(k))));&lt;BR /&gt;
%mend temp;&lt;BR /&gt;
%temp;&lt;BR /&gt;
 Now it will not give error.&lt;BR /&gt;
however I expect an error because %sysfunc(.. will unquote result whiich actually containts semi colon. if you replace&lt;BR /&gt;
%let line_length=%length(%sysfunc(tranwrd(&amp;amp;line,%str(a),%str(k))));&lt;BR /&gt;
by %let line_length=%sysfunc(tranwrd(&amp;amp;line,%str(a),%str(k)));&lt;BR /&gt;
it will give error because unquoting is occuring.&lt;BR /&gt;
So I am not clear what does %length do so that there is no error?</description>
      <pubDate>Tue, 09 Feb 2010 14:00:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54526#M11556</guid>
      <dc:creator>VAMA</dc:creator>
      <dc:date>2010-02-09T14:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: %length with quoted data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54527#M11557</link>
      <description>Suggest you add the line below to generate more diagnostics during compilation.  The problem is that your semi-colon characters have meaning while the macro compiler is resolving &amp;amp;line but prior to the outer functions.&lt;BR /&gt;
&lt;BR /&gt;
options source source2 macrogen symbolgen mlogic nomprint;&lt;BR /&gt;
&lt;BR /&gt;
Hopefully with this additional SAS log diag output, you will see what's going on with the macro compiler as it is parsing and resolving each code line.&lt;BR /&gt;
&lt;BR /&gt;
Also, suggest using additional statements (as needed for diagnosis), such as:&lt;BR /&gt;
&lt;BR /&gt;
%put _user_;&lt;BR /&gt;
&lt;BR /&gt;
%put _all_;&lt;BR /&gt;
&lt;BR /&gt;
%put _global_;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Good luck with your experience.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 09 Feb 2010 14:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54527#M11557</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-02-09T14:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: %length with quoted data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54528#M11558</link>
      <description>Ok I get your point seems like I have refer to macro documentation and update my understanding &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 09 Feb 2010 15:14:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54528#M11558</guid>
      <dc:creator>VAMA</dc:creator>
      <dc:date>2010-02-09T15:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: %length with quoted data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54529#M11559</link>
      <description>Maybe for nested function calls as used here the "value" that %LENGTH operates on is not passed back to the word scanner but is passed to %LENGTH as a pointer.  &lt;BR /&gt;
&lt;BR /&gt;
Isn't it the word scanner that needs simicolons and other special symbols quoted?</description>
      <pubDate>Tue, 09 Feb 2010 16:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/length-with-quoted-data/m-p/54529#M11559</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-02-09T16:25:10Z</dc:date>
    </item>
  </channel>
</rss>

