<?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: Control FILLPATTERN in Box Plot, when there is no enough Data in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Control-FILLPATTERN-in-Box-Plot-when-there-is-no-enough-Data/m-p/969520#M25585</link>
    <description>&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jun 2025 03:02:40 GMT</pubDate>
    <dc:creator>SASuserlot</dc:creator>
    <dc:date>2025-06-23T03:02:40Z</dc:date>
    <item>
      <title>Control FILLPATTERN in Box Plot, when there is no enough Data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Control-FILLPATTERN-in-Box-Plot-when-there-is-no-enough-Data/m-p/968407#M25579</link>
      <description>&lt;P&gt;I am using the following code to generate the box plot. However My carmodel with Red color have only one record.&amp;nbsp; I want to display the patterns to every Blue and Green colors, but not for the 'Red' color group . Is there any way I can control it? thank you in advance.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create dataset with 20 cars - Volvo/Fiat/Land Rover forced to Red */
data car_performance;
    length CarModel $20 Color $10;
    
    /* Define car models */
    array car_models[20] $20 _temporary_ (
        "Toyota Camry", "Honda Accord", "Ford Mustang", "Chevrolet Corvette", 
        "BMW M3", "Tesla Model S", "Audi A4", "Subaru Outback", 
        "Jeep Wrangler", "Porsche 911", "Lexus RX", "Hyundai Sonata", 
        "Volkswagen Golf", "Mazda CX-5", "Mercedes C-Class", "Nissan Altima", 
        "Kia Telluride", "Volvo XC90", "Land Rover Defender", "Fiat 500"
    );
    
    /* Define colors (Green replaces Silver) */
    array colors[2] $10 _temporary_ ("Blue", "Green");
    
    /* Generate data */
    do i = 1 to 20;
        CarModel = car_models[i];
        
        /* Force Volvo, Fiat, Land Rover to Red */
        if CarModel in ("Volvo XC90", "Fiat 500", "Land Rover Defender") then 
            Color = "Red";
        /* Distribute others evenly between Blue/Green */
        else 
            Color = colors[mod(i, 2) + 1];
        
        /* Random MPG values (color-specific ranges) */
        if Color = "Red" then 
            MPG = round(18 + 12 * ranuni(0));       /* Red: 18-30 MPG */
        else if Color = "Blue" then 
            MPG = round(22 + 10 * ranuni(0));       /* Blue: 22-32 MPG */
        else 
            MPG = round(25 + 8 * ranuni(0));        /* Green: 25-33 MPG */
        
        output;
    end;
    
    drop i;
run;

data xx;
	set car_performance;
	if CARMODEL in ('Volvo XC90' 'Land Rover Defender') and color = 'Red' then delete;
run;

options orientation = landscape errors = 2 missing = ' ' nofmterr ls = 175 validvarname = upcase  nobyline;
ods graphics on / attrpriority=none reset=all width=9.0in height=4.6in border=off;

ods escapechar = '^';
ods results on; 
ods listing close; 
ods rtf file = "C:\temp\test.rtf" ; 

proc sgplot data=xx;

    title "Car MPG Distribution by Color";
    vbox MPG / category=Color 
               dataskin=none 
			   fillpattern
              
               lineattrs=(thickness=2);
    
    /* Customize colors in the plot */
    styleattrs  datafillpatterns=(X1);
    
    xaxis label="Car Color";
    yaxis label="Miles Per Gallon (MPG)" grid;
run;
ods rtf close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1749423690171.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107689i4D9043E53FC63ABC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1749423690171.png" alt="SASuserlot_0-1749423690171.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jun 2025 23:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Control-FILLPATTERN-in-Box-Plot-when-there-is-no-enough-Data/m-p/968407#M25579</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2025-06-08T23:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Control FILLPATTERN in Box Plot, when there is no enough Data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Control-FILLPATTERN-in-Box-Plot-when-there-is-no-enough-Data/m-p/968416#M25580</link>
      <description>&lt;PRE&gt;options orientation = landscape errors = 2 missing = ' ' nofmterr ls = 175 validvarname = upcase  nobyline;
ods graphics on / attrpriority=none reset=all width=9.0in height=4.6in border=off  &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;outputfmt=png;&lt;/STRONG&gt;&lt;/FONT&gt;

ods escapechar = '^';
ods results on; 
ods listing close; 
ods rtf file = "C:\temp\test.rtf" ; 

proc sgplot data=xx;

    title "Car MPG Distribution by Color";
    vbox MPG / category=Color 
               dataskin=none 
			   fillpattern
              
               lineattrs=(thickness=2);
    
    /* Customize colors in the plot */
    styleattrs  datafillpatterns=(X1);
    
    xaxis label="Car Color";
    yaxis label="Miles Per Gallon (MPG)" grid;
run;
ods rtf close;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1749437404707.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107693i5BD6C2050D44C167/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1749437404707.png" alt="Ksharp_0-1749437404707.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 02:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Control-FILLPATTERN-in-Box-Plot-when-there-is-no-enough-Data/m-p/968416#M25580</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-06-09T02:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Control FILLPATTERN in Box Plot, when there is no enough Data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Control-FILLPATTERN-in-Box-Plot-when-there-is-no-enough-Data/m-p/968418#M25581</link>
      <description>&lt;P&gt;And Answer is yes. but you need to polt this BOX graphc twice .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;options orientation = landscape errors = 2 missing = ' ' nofmterr ls = 175 validvarname = upcase  nobyline;
ods graphics on / attrpriority=none reset=all width=9.0in height=4.6in border=off  &lt;STRONG&gt;outputfmt=png&lt;/STRONG&gt;;

ods escapechar = '^';
ods results on; 
ods listing close; 
ods rtf file = "C:\temp\test.rtf" ; 
&lt;STRONG&gt;data xx1;
 set xx;
 if COLOR ne 'Red' then MPG1=MPG;
run;&lt;/STRONG&gt;
proc sgplot data=xx1 noautolegend;

    title "Car MPG Distribution by Color";
	&lt;STRONG&gt;vbox MPG / category=Color 
               dataskin=none  fillattrs=(color=lightblue)
               lineattrs=(thickness=2);
    vbox MPG1 / category=Color 
               dataskin=none 
			   fillpattern nofill
               lineattrs=(thickness=2 );
    
    /* Customize colors in the plot */
    styleattrs  datafillpatterns=(X1) datacolors=(black) datacontrastcolors=(black);&lt;/STRONG&gt;
    
    xaxis label="Car Color";
    yaxis label="Miles Per Gallon (MPG)" grid;
run;
ods rtf close;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1749438373717.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107694iA7A573650526F43C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1749438373717.png" alt="Ksharp_0-1749438373717.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 03:06:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Control-FILLPATTERN-in-Box-Plot-when-there-is-no-enough-Data/m-p/968418#M25581</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-06-09T03:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Control FILLPATTERN in Box Plot, when there is no enough Data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Control-FILLPATTERN-in-Box-Plot-when-there-is-no-enough-Data/m-p/969520#M25585</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jun 2025 03:02:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Control-FILLPATTERN-in-Box-Plot-when-there-is-no-enough-Data/m-p/969520#M25585</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2025-06-23T03:02:40Z</dc:date>
    </item>
  </channel>
</rss>

