<?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 Using two data sources in a proc sgplot procedure in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195437#M7232</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm creating a graph with exposure across different levels of a factor, vehicle age. On a secondary axis I include the average frequency per level. My code is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; proc sgplot data=dataset1 (where=(compress(level) not in ('-1','Z.Unknown')));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; title "Vehicle Age";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vbar level / group = source response = exposure;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This produces the graph with exposure split by source for each level but I want to include the average frequency on the secondary axis but this is available on another dataset that doesn't split out exposure into source. So in dataset 1, there is an average frequency but this is given for each source in each vehicle age. I want to use the overall average frequency for each level. something like...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; proc sgplot data=Egidwh_oneway_yr3 (where=(rank &amp;lt;= 10 and compress(factor) = "glm_4_vehicl_vehicle_age" and compress(level) not in ('-1','Z.Unknown')));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; title "&amp;amp;factor - Exposure By Year";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vbar level / group = source response = exposure;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vline level / response=freq y2axis;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but where the vline info comes from the more summarized dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any ideas??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Mar 2015 19:08:05 GMT</pubDate>
    <dc:creator>brophymj</dc:creator>
    <dc:date>2015-03-05T19:08:05Z</dc:date>
    <item>
      <title>Using two data sources in a proc sgplot procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195437#M7232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm creating a graph with exposure across different levels of a factor, vehicle age. On a secondary axis I include the average frequency per level. My code is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; proc sgplot data=dataset1 (where=(compress(level) not in ('-1','Z.Unknown')));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; title "Vehicle Age";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vbar level / group = source response = exposure;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This produces the graph with exposure split by source for each level but I want to include the average frequency on the secondary axis but this is available on another dataset that doesn't split out exposure into source. So in dataset 1, there is an average frequency but this is given for each source in each vehicle age. I want to use the overall average frequency for each level. something like...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; proc sgplot data=Egidwh_oneway_yr3 (where=(rank &amp;lt;= 10 and compress(factor) = "glm_4_vehicl_vehicle_age" and compress(level) not in ('-1','Z.Unknown')));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; title "&amp;amp;factor - Exposure By Year";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vbar level / group = source response = exposure;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vline level / response=freq y2axis;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but where the vline info comes from the more summarized dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any ideas??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 19:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195437#M7232</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2015-03-05T19:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using two data sources in a proc sgplot procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195438#M7233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The place to start would be to combine the data sets:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data plot;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set dataset1 dataset2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As long as your summary dataset does not have values for Exposure and the first no values for Freq then you should be good to go.&lt;/P&gt;&lt;P&gt;HINT: Keep only&amp;nbsp; the variables you need for the plot if you have lots. And since you have such complex where criteria, do that in the combination step, it looks like on the first dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 21:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195438#M7233</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-03-05T21:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using two data sources in a proc sgplot procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195439#M7234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brilliant, that makes perfect sense. Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 21:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195439#M7234</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2015-03-05T21:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using two data sources in a proc sgplot procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195440#M7235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried this but I get the following error message:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Once a GROUP variable is used in a categorical chart, that GROUP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable must be used in all overlaid charts.&amp;nbsp; The specified GROUP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable has been removed from the graph display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data vehage(keep = factor level all_freq all_sev flag4 );&lt;BR /&gt;set Egidwh_oneway4;&lt;BR /&gt;if compress(factor) = "glm_4_vehicl_vehicle_age";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data vehageyr(drop = all_freq all_sev ) ;&lt;BR /&gt;set Egidwh_oneway_yr3;&lt;BR /&gt;if compress(factor) = "glm_4_vehicl_vehicle_age";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data comb;&lt;BR /&gt;set vehage vehageyr;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc sgplot data=comb (where=(flag4 = "Y" and compress(factor) = "glm_4_vehicl_vehicle_age" and compress(level) not in ('-1','Z.Unknown')));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; title "vehicle_age - Severity";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vbar level / group = source response=exposure;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vline level /&amp;nbsp; response=all_freq y2axis;&lt;BR /&gt;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 23:44:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195440#M7235</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2015-03-05T23:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using two data sources in a proc sgplot procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195441#M7236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I missed the group part before. I way is to add a level for group to the summary data (probably only one) and add to the vline syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data comb;&lt;/P&gt;&lt;P&gt;set vehage vehageyr (in=in1);&lt;/P&gt;&lt;P&gt;/* assuming that vehageyr is the summary data lacking the Source Variable*/&lt;/P&gt;&lt;P&gt;if in1 then Source = &amp;lt;a source value&amp;gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;to prevent the second plot from adding to the legend use the NAME="text" to name each of the plots by using KEYLEGEND "text" ; where text is the same text used for the VBAR name option.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 00:30:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195441#M7236</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-03-06T00:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using two data sources in a proc sgplot procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195442#M7237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you give a little example of this, I don't quite follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 08:46:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195442#M7237</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2015-03-06T08:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using two data sources in a proc sgplot procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195443#M7238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; proc sgplot data=comb (where=(flag4 = "Y" and compress(factor) = "glm_4_vehicl_vehicle_age" and compress(level) not in ('-1','Z.Unknown')));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; title "vehicle_age - Severity";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vbar level / group = source response=exposure name='bar';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vline level /&amp;nbsp; group=source response=all_freq y2axis name='line';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keylegend 'bar';&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 16:21:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Using-two-data-sources-in-a-proc-sgplot-procedure/m-p/195443#M7238</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-03-06T16:21:10Z</dc:date>
    </item>
  </channel>
</rss>

