<?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: GTL conditional logic question in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/248957#M9040</link>
    <description>&lt;P&gt;Rick,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, I had not thought of that.&amp;nbsp; I can make it work although I'll have to play games to get my drill down pointers to work.&amp;nbsp; I'll also have to make two passes through the data which I would rather avoid.&amp;nbsp; My SGRENDER currently takes about 3 minutes because of the sheer number of observations it reads.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not complaining because you have given me a solution - which I didn't have.&amp;nbsp; I just was hoping for something more elegant.&amp;nbsp; But this runs in batch at night so it should not be a big deal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again,&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
    <pubDate>Tue, 09 Feb 2016 17:00:32 GMT</pubDate>
    <dc:creator>jimhorne</dc:creator>
    <dc:date>2016-02-09T17:00:32Z</dc:date>
    <item>
      <title>GTL conditional logic question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/248843#M9029</link>
      <description>&lt;P&gt;I have a GTL template question on conditional formatting.&amp;nbsp; I have a series of graphs I render with SGRENDER with a BY statement.&amp;nbsp; Let’s say my BY statement looks like&lt;/P&gt;
&lt;P&gt;BY var1 var2 var3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;VAR2 has a range from 0 to 5.&amp;nbsp; When it is 0 (zero) I want to draw a different graph.&amp;nbsp; I tried using DYNAMIC variables but that didn’t do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way I can do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Jim Horne&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2016 13:01:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/248843#M9029</guid>
      <dc:creator>jimhorne</dc:creator>
      <dc:date>2016-02-09T13:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: GTL conditional logic question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/248850#M9030</link>
      <description>&lt;P&gt;I suggest you write two templates and call them conditionally from PROC SGRENDER by using a WHERE clause:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgrender data=Have template=TmplNonZero;
where var2 &amp;gt; 0;
by var1 var2 var3;
run;

proc sgrender data=Have template=TmplZero;
where var2 = 0;
by var1 var2 var3;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Feb 2016 14:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/248850#M9030</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-02-09T14:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: GTL conditional logic question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/248957#M9040</link>
      <description>&lt;P&gt;Rick,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, I had not thought of that.&amp;nbsp; I can make it work although I'll have to play games to get my drill down pointers to work.&amp;nbsp; I'll also have to make two passes through the data which I would rather avoid.&amp;nbsp; My SGRENDER currently takes about 3 minutes because of the sheer number of observations it reads.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not complaining because you have given me a solution - which I didn't have.&amp;nbsp; I just was hoping for something more elegant.&amp;nbsp; But this runs in batch at night so it should not be a big deal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again,&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2016 17:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/248957#M9040</guid>
      <dc:creator>jimhorne</dc:creator>
      <dc:date>2016-02-09T17:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: GTL conditional logic question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249035#M9043</link>
      <description>&lt;P&gt;I would be surprised if this lengthens the execution time by much. Reading the data is usually much faster than creating the graphs.&amp;nbsp; It might even speed things up, since each call to SGRENDER has less data to process. Report back on how long it takes after you get it working.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2016 19:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249035#M9043</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-02-09T19:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: GTL conditional logic question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249121#M9045</link>
      <description>&lt;P&gt;Three minutes? &amp;nbsp;I would like to see this use case with data to see what is taking so long.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 03:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249121#M9045</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2016-02-10T03:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: GTL conditional logic question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249160#M9046</link>
      <description>&lt;P&gt;RIck and Sanjay,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the replies.&amp;nbsp; Rick, you were right, run time did not go up at all.&amp;nbsp; It may have actually taken a few seconds off the run time.&amp;nbsp; In testing, that seems to be the case.&amp;nbsp; Sanjay, I don't know if you need to see the data or just to know that a total of over 200 graphs are produced.&amp;nbsp; This mornings runs (production and my test split out) each took about two minutes 20 seconds in the SGRENDER steps for this work.&amp;nbsp; Since each graph is a four part panel this may be why it takes the time it does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again for your help,&lt;/P&gt;
&lt;P&gt;Jim Horne&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 11:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249160#M9046</guid>
      <dc:creator>jimhorne</dc:creator>
      <dc:date>2016-02-10T11:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: GTL conditional logic question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249179#M9048</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know your question has already been answered by Rick and for future reference, if you did want to create a flexible template than you need to use the _byvar_ and _byval_ dynamic variables in your template. This will allow you to do different graphs dependent on your data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is an example, and you can see that the template is using if (_byval2_ = 0) instead of if (cyclinders = 0). This is a very important part of the conditional statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data cars;
  set sashelp.cars;
  where make = "Audi";
  if Cylinders = 6 then Cylinders = 0;
run;

proc sort data = cars;
  by make Cylinders;
run;

proc template;
  define statgraph cond;
  dynamic _byval_ _byvar_ _byval2_ _byvar2_;
    begingraph;
      if (_byval2_ = 0) /* Plot for 0 condition */
	    layout overlay;
	       barchart x = make y = horsepower / stat = sum fillattrs = (color=red);
		endlayout;
	  else 
	    layout overlay;
	       barchart x = make y = _byvar2_ / fillattrs = (color=blue);
		endlayout;
	  endif;
	endgraph;
  end;
run;


proc sgrender data = cars template=cond;
  by make cylinders;
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 13:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249179#M9048</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2016-02-10T13:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: GTL conditional logic question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249208#M9050</link>
      <description>&lt;P&gt;That's perfect.&amp;nbsp; It only required adding three lines to my existing production teplate - the DYNMIC statement for the _BYVAL_ and _BYVALn_ variables, and the IF - ENDIF construct around the cell that cannot write data if the BY varoable I check = 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's elegant - and easy to maintain.&amp;nbsp; I wish the automtic variables were easier to find.&amp;nbsp; When I read your post I Googled "SAS DYNAMIC _BYVAL_" and found it in the GTL User Guide buried in a section I managed to overlook.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 15:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249208#M9050</guid>
      <dc:creator>jimhorne</dc:creator>
      <dc:date>2016-02-10T15:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: GTL conditional logic question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249224#M9051</link>
      <description>&lt;P&gt;Perfect! Glad it helped.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, I remember it taking me a while to find the solution when I wanted to add dynamic titles to my graphs.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 16:05:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GTL-conditional-logic-question/m-p/249224#M9051</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2016-02-10T16:05:09Z</dc:date>
    </item>
  </channel>
</rss>

