<?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: Multiple REFERENCELINE values, no problem. Single REFERENCELINE value does not appear in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Multiple-REFERENCELINE-values-no-problem-Single-REFERENCELINE/m-p/241832#M8779</link>
    <description>&lt;P&gt;Indeed, &lt;FONT face="courier new,courier"&gt;exists()&lt;/FONT&gt;&amp;nbsp;does allow&amp;nbsp;zero, 1 or multiple values! Although I cannot say that this works as I would expect &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did not expect EXISTS() to return zero when _REFLINES has a value that resolves to null -- e.g., pass in "&amp;amp;ref_lines" that resolves to "". According to &lt;A href="http://support.sas.com/documentation/cdl/en/grstatug/67914/HTML/default/viewer.htm#p0h7ijpcw8oz36n1mgffnqacymnn.htm" target="_self"&gt;EXISTS() documentation&lt;/A&gt;: "If item is a dynamic / macro variable, then it tests whether there has been a run-time initialization of the variable."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I expected that&amp;nbsp;setting &lt;FONT face="courier new,courier"&gt;_REFLINES="&amp;amp;ref_lines"&lt;/FONT&gt;&amp;nbsp;nonetheless counts as run-time initialization, even if &lt;FONT face="courier new,courier"&gt;&amp;amp;ref_lines&lt;/FONT&gt; resolves to a null string. I expected EXISTS("") to return 1, but LENGTH("") to return 0.&amp;nbsp;So I didn't consider using EXISTS(). Lesson learned. And thanks for a solution!&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jan 2016 14:26:51 GMT</pubDate>
    <dc:creator>DDT</dc:creator>
    <dc:date>2016-01-05T14:26:51Z</dc:date>
    <item>
      <title>Multiple REFERENCELINE values, no problem. Single REFERENCELINE value does not appear</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Multiple-REFERENCELINE-values-no-problem-Single-REFERENCELINE/m-p/241814#M8777</link>
      <description>&lt;P&gt;This is a continuation of my &lt;A href="https://communities.sas.com/t5/SAS-GRAPH-and-ODS-Graphics/Why-NOTE-The-graph-will-be-rendered-as-an-image-due-to-the-use/m-p/241563" target="_blank"&gt;GTL Box plot learning curve&lt;/A&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I have Win64 SAS &lt;STRONG&gt;9.4 M2&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Working with the&amp;nbsp;code, below, I can easily get either&amp;nbsp;zero&amp;nbsp;or&amp;nbsp;multiple reference line(s) to display. For example, use&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;_REFLINES="0,9"&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt; in the code, below, instead of &lt;FONT face="courier new,courier" color="#FF0000"&gt;&lt;STRONG&gt;_REFLINES="100"&lt;/STRONG&gt;&lt;/FONT&gt;. But I cannot get exactly 1 reference line, e.g., 100, to conditionally appear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="line-height: 20px;"&gt;Use the &lt;/SPAN&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/grstatgraph/67882/HTML/default/p03jtr6n56wu4ln1k77szqw1fjkc.htm#p0v1yx8po8sixln1rteqhrs8ubvm" target="_blank"&gt;&lt;STRONG&gt;Y=&lt;/STRONG&gt; options with &lt;STRONG&gt;COLN()&lt;/STRONG&gt; function as documented here&lt;/A&gt;&lt;SPAN style="line-height: 20px;"&gt;.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="line-height: 20px;"&gt;Use &lt;A href="http://support.sas.com/documentation/cdl/en/grstatug/67914/HTML/default/viewer.htm#p04htpbazqxvl8n15n5o2hrxlepd.htm" target="_self"&gt;conditional template language as documented here&lt;/A&gt;, aware of the implied EVAL() for the IF statement.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="line-height: 20px;"&gt;Conditionally handle zero, 1, or several reference lines without warnings. "zero" and "several" work as expected!&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;&lt;STRONG&gt;Specifying&amp;nbsp;exactly 1 reference line does not work,&lt;/STRONG&gt; and seems to fail because the &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;EVAL(LENGTH(_REFLINES))&lt;/FONT&gt;&lt;/STRONG&gt; return value is missing &lt;EM&gt;when _REFLINES contains only digits&lt;/EM&gt;. Note that I have printed the result of this evaluation in the graph title.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;Without&amp;nbsp;a proper result&amp;nbsp;from eval(length()), it's hard to program around using COLN() or a single value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;I've tried searching these communities, as well as SAS Notes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;Notable&amp;nbsp;behavior, the same whether I use LENGTH() or &lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/67960/HTML/default/viewer.htm#n1kkgqelwql5syn1mr4zx8ia0nup.htm" target="_blank"&gt;LENGTH&lt;STRONG&gt;C&lt;/STRONG&gt;()&lt;/A&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;EVAL(LENGTH(_REFLINES))&lt;/FONT&gt; is &lt;STRONG&gt;missing, zero-length&lt;/STRONG&gt;, for &lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#FF0000"&gt;_REFLINES="100"&lt;/FONT&gt;&lt;/STRONG&gt;. Check the title text.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;_REFLINES="100"&lt;/FONT&gt; works as expected with &lt;FONT face="courier new,courier"&gt;COLN()&lt;/FONT&gt;, if I remove the conditional code &lt;FONT face="courier new,courier"&gt;IF EVAL(LENGTH(_REFLINES) &amp;gt; 0)&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;ENDIF;&lt;/FONT&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="line-height: 20px;"&gt;Use&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;_REFLINES="100 a"&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN style="line-height: 20px;"&gt; in the code, below, instead of &lt;/SPAN&gt;&lt;FONT face="courier new,courier" color="#FF0000"&gt;&lt;STRONG&gt;_REFLINES="100"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN style="line-height: 20px;"&gt;. and I magically get the 100 line, a correct length of 5, and no syntax warning or error (but COLN() does not like "100,a").&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="line-height: 20px;"&gt;Use&amp;nbsp;&lt;FONT face="courier new,courier" color="#FF0000"&gt;&lt;STRONG&gt;_REFLINES="100 &amp;nbsp;"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN style="line-height: 20px;"&gt;&amp;nbsp;(trailing blanks) in the code, below, and change LENGTH() to &lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/67960/HTML/default/viewer.htm#n1kkgqelwql5syn1mr4zx8ia0nup.htm" target="_blank"&gt;LENGTH&lt;STRONG&gt;C&lt;/STRONG&gt;()&lt;/A&gt; which should not strip trailing blanks, but the single reference line is still omitted, and the length() in the title is still null.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="line-height: 20px;"&gt;&lt;SPAN style="line-height: 20px;"&gt;&lt;FONT face="courier new,courier" color="#FF0000"&gt;_REFLINES="100 110"&lt;/FONT&gt; produces errors, just to confirm that COLN() expects comma-delimited values.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;Are there some known problems with EVAL(LENGTH(...)) or fixes in SAS 9.4 after M2?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Must the string to test include some non-digit, non-space character (a bit unexpected to me)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;Here's the play code, and thanks for any advice or alternate approach:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;      proc template;
        define statgraph xalignedstats;
          dynamic _GRP _CAT _MEASURE _REFLINES;

          begingraph / border=false dataskin=none;
            entrytitle 'Check result of eval(length(_REFLINES)) [' EVAL(LENGTH(_REFLINES)) ']';
            layout overlay / walldisplay=none xaxisopts=(discreteopts=(tickvaluefitpolicy=split));
              boxplot x=_CAT y=_MEASURE / group=_GRP groupdisplay=cluster;

              IF (length(_REFLINES) &amp;gt; 0)

                referenceline y=eval(coln(_REFLINES)) / lineattrs=(color=red);

              ENDIF;&lt;BR /&gt;
            endlayout;
          endgraph;
        end;
      run;

      proc sgrender data=sashelp.heart template=xalignedstats;
        dynamic 
                _GRP     ='bp_status'
                _CAT     ='smoking_status' 
                _MEASURE ='diastolic'
                _REFLINES="100"
                ;
      run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 11:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Multiple-REFERENCELINE-values-no-problem-Single-REFERENCELINE/m-p/241814#M8777</guid>
      <dc:creator>DDT</dc:creator>
      <dc:date>2016-01-05T11:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple REFERENCELINE values, no problem. Single REFERENCELINE value does not appear</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Multiple-REFERENCELINE-values-no-problem-Single-REFERENCELINE/m-p/241821#M8778</link>
      <description>&lt;P&gt;Can you not use the exists() function on the _REFLINES variable? &amp;nbsp;The below works fine on mine:&lt;/P&gt;
&lt;PRE&gt;proc template;
  define statgraph xalignedstats;
  dynamic _GRP _CAT _MEASURE _REFLINES;
  begingraph / border=false dataskin=none;
  entrytitle 'Check result of eval(length(_REFLINES)) [' EVAL(LENGTH(_REFLINES)) ']';
  layout overlay / walldisplay=none xaxisopts=(discreteopts=(tickvaluefitpolicy=split));
    boxplot x=_CAT y=_MEASURE / group=_GRP groupdisplay=cluster;
    IF (exists(_REFLINES) &amp;gt; 0)
      referenceline y=eval(coln(_REFLINES)) / lineattrs=(color=red);
    ENDIF;
  endlayout;
  endgraph;
  end;
run;

proc sgrender data=sashelp.heart template=xalignedstats;
  dynamic 
  _GRP     ='bp_status'
  _CAT     ='smoking_status' 
  _MEASURE ='diastolic'
  _REFLINES="100";
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Jan 2016 13:17:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Multiple-REFERENCELINE-values-no-problem-Single-REFERENCELINE/m-p/241821#M8778</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-01-05T13:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple REFERENCELINE values, no problem. Single REFERENCELINE value does not appear</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Multiple-REFERENCELINE-values-no-problem-Single-REFERENCELINE/m-p/241832#M8779</link>
      <description>&lt;P&gt;Indeed, &lt;FONT face="courier new,courier"&gt;exists()&lt;/FONT&gt;&amp;nbsp;does allow&amp;nbsp;zero, 1 or multiple values! Although I cannot say that this works as I would expect &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did not expect EXISTS() to return zero when _REFLINES has a value that resolves to null -- e.g., pass in "&amp;amp;ref_lines" that resolves to "". According to &lt;A href="http://support.sas.com/documentation/cdl/en/grstatug/67914/HTML/default/viewer.htm#p0h7ijpcw8oz36n1mgffnqacymnn.htm" target="_self"&gt;EXISTS() documentation&lt;/A&gt;: "If item is a dynamic / macro variable, then it tests whether there has been a run-time initialization of the variable."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I expected that&amp;nbsp;setting &lt;FONT face="courier new,courier"&gt;_REFLINES="&amp;amp;ref_lines"&lt;/FONT&gt;&amp;nbsp;nonetheless counts as run-time initialization, even if &lt;FONT face="courier new,courier"&gt;&amp;amp;ref_lines&lt;/FONT&gt; resolves to a null string. I expected EXISTS("") to return 1, but LENGTH("") to return 0.&amp;nbsp;So I didn't consider using EXISTS(). Lesson learned. And thanks for a solution!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 14:26:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Multiple-REFERENCELINE-values-no-problem-Single-REFERENCELINE/m-p/241832#M8779</guid>
      <dc:creator>DDT</dc:creator>
      <dc:date>2016-01-05T14:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple REFERENCELINE values, no problem. Single REFERENCELINE value does not appear</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Multiple-REFERENCELINE-values-no-problem-Single-REFERENCELINE/m-p/241835#M8780</link>
      <description>And of course, not to overlook what still troubles me:&lt;BR /&gt;&lt;BR /&gt;I don't understand why EVAL(LENGTH("100")) returns a null value...</description>
      <pubDate>Tue, 05 Jan 2016 14:36:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Multiple-REFERENCELINE-values-no-problem-Single-REFERENCELINE/m-p/241835#M8780</guid>
      <dc:creator>DDT</dc:creator>
      <dc:date>2016-01-05T14:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple REFERENCELINE values, no problem. Single REFERENCELINE value does not appear</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Multiple-REFERENCELINE-values-no-problem-Single-REFERENCELINE/m-p/241862#M8783</link>
      <description>&lt;P&gt;Yes, to be honest I am not sure why that doesn't work. It looks valid, but I rarely use conditionals in templates as there isnt a debugger for them, it would be a good feature if you could put this type of thing to the log to see what the condition being evaluated is, could it be that the eval in this instance is called with the text 'length("100,110")' so its not call the function just evaluating certain characters. &amp;nbsp;I don't know I am afraid, good question to put to tech support.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 17:13:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Multiple-REFERENCELINE-values-no-problem-Single-REFERENCELINE/m-p/241862#M8783</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-01-05T17:13:40Z</dc:date>
    </item>
  </channel>
</rss>

