<?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: sgplot vbar plot subset with main set in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-vbar-plot-subset-with-main-set/m-p/405964#M13864</link>
    <description>&lt;P&gt;You can use the VBARPARM statement with aggregated data using two different category variables or you make use of an additional&lt;/P&gt;
&lt;P&gt;grouping variable and use the VBAR statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See code sample below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cars2;
  set sashelp.cars;
  length group $ 8;
  if type = "SUV" then do;
    group = "SUV";
  end;
  else do;
    group="other";
  end;
run;

proc sgplot data=cars2 noautolegend;
  vbar type / response=invoice stat=mean group=group ;
run;

data vehicle;
  length  
    vehicle_no vehicle_no_subset $ 8
  ;
  do vehicle_no = "3725", "3727", "3728", "3729", "4725", "4727", "4728", "4729";
    response + 1;
    call missing(vehicle_no_subset);
    if vehicle_no in ("3725", "3727", "3728", "3729") then do;
      vehicle_no_subset = vehicle_no;
    end;
    output;
  end;
run;

proc sgplot data=work.vehicle;
  vbarparm category=vehicle_no response=response;
  vbarparm category=vehicle_no_subset response=response;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 20 Oct 2017 14:25:36 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2017-10-20T14:25:36Z</dc:date>
    <item>
      <title>sgplot vbar plot subset with main set</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-vbar-plot-subset-with-main-set/m-p/405949#M13862</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to plot a vbar like plot with a subset that is highlighted. I tried the following and got an error message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=has;
	yaxis label= "...";
	vbar VEHICLE_NO;
	vbar VEHICLE_NO_subset;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The error message follows:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ERROR: The same category variable must be used for summarized plots.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 13:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-vbar-plot-subset-with-main-set/m-p/405949#M13862</guid>
      <dc:creator>capam</dc:creator>
      <dc:date>2017-10-20T13:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot vbar plot subset with main set</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-vbar-plot-subset-with-main-set/m-p/405955#M13863</link>
      <description>&lt;P&gt;The subset was generated as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data has;
	set has;
	by vehicle_no;

	if FAULT_CODE = '20-2018' and VEHICLE_NO in ("3725" "3727" "3728" "3729" 
		"3730" "3734" "3737" "3739" "3740" "3741" "3742" "3745" ) then
		do;
			vehicle_no_subset=vehicle_no;
		end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Oct 2017 13:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-vbar-plot-subset-with-main-set/m-p/405955#M13863</guid>
      <dc:creator>capam</dc:creator>
      <dc:date>2017-10-20T13:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot vbar plot subset with main set</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-vbar-plot-subset-with-main-set/m-p/405964#M13864</link>
      <description>&lt;P&gt;You can use the VBARPARM statement with aggregated data using two different category variables or you make use of an additional&lt;/P&gt;
&lt;P&gt;grouping variable and use the VBAR statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See code sample below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cars2;
  set sashelp.cars;
  length group $ 8;
  if type = "SUV" then do;
    group = "SUV";
  end;
  else do;
    group="other";
  end;
run;

proc sgplot data=cars2 noautolegend;
  vbar type / response=invoice stat=mean group=group ;
run;

data vehicle;
  length  
    vehicle_no vehicle_no_subset $ 8
  ;
  do vehicle_no = "3725", "3727", "3728", "3729", "4725", "4727", "4728", "4729";
    response + 1;
    call missing(vehicle_no_subset);
    if vehicle_no in ("3725", "3727", "3728", "3729") then do;
      vehicle_no_subset = vehicle_no;
    end;
    output;
  end;
run;

proc sgplot data=work.vehicle;
  vbarparm category=vehicle_no response=response;
  vbarparm category=vehicle_no_subset response=response;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Oct 2017 14:25:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-vbar-plot-subset-with-main-set/m-p/405964#M13864</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-10-20T14:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot vbar plot subset with main set</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-vbar-plot-subset-with-main-set/m-p/405977#M13866</link>
      <description>Thanks Bruno.&lt;BR /&gt;&lt;BR /&gt;I'm not clear on initializing response.. Also, the do in 'do vehicle_no in ...' is not in purple. There may be a syntax error.</description>
      <pubDate>Fri, 20 Oct 2017 14:56:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-vbar-plot-subset-with-main-set/m-p/405977#M13866</guid>
      <dc:creator>capam</dc:creator>
      <dc:date>2017-10-20T14:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot vbar plot subset with main set</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-vbar-plot-subset-with-main-set/m-p/405995#M13867</link>
      <description>&lt;P&gt;Just try the code I provided, to see if the graphs looks the way you intend. Since you did not provide any test data, I had to create some data myself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You then need to adapt your code accordingly either using the technique with the "group" variable or have a second category variable and use the VBARPARM statement. this data needs to be aggregated, as VBARPARM just plots the information, but does not do any aggregation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 15:24:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-vbar-plot-subset-with-main-set/m-p/405995#M13867</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-10-20T15:24:21Z</dc:date>
    </item>
  </channel>
</rss>

