<?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 Boxplot Help in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Boxplot-Help/m-p/906737#M40515</link>
    <description>&lt;P&gt;Hi SAS Coders!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a box plot that looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2023-12-07 at 9.43.09 AM.png" style="width: 679px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90945i166A42D5577C2702/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2023-12-07 at 9.43.09 AM.png" alt="Screen Shot 2023-12-07 at 9.43.09 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;My quartiles are out of order and I have tried everything. Here is my code for reference:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS NOPROCTITLE;
PROC SGPLOT DATA=WORK.FIGURE;
  VBOX outcomes_adults_mental_distr / 
    GROUPORDER = DATA  
    CATEGORY=Quartiles   
    FILLATTRS=(COLOR=LIGHTBLUE) BOXWIDTH=0.8;
  TITLE BOLD "Boxplot of Quartiles of Marijuana Use and Frequent Mental Distress";
  XAXIS DISPLAY=(NOLABEL) LABELATTRS=(WEIGHT=BOLD);
  YAXIS LABEL="Frequent Mental Distress" VALUES=(0 TO 100 BY 10) OFFSETMIN=0;
  XAXIS LABEL="Quartiles";
  REFLINE 70 / AXIS=Y LINEATTRS=(COLOR=BLUE);
  REFLINE 90 / AXIS=Y LINEATTRS=(COLOR=BLUE);
  YAXIS GRID;
  INSET "Data Source: Colorado Study Data"/ POSITION=NW BORDER;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How do I get it where it goes from "First Quartile, Second Quartile, Third Quartile and Fourth Quartile" ?&lt;/P&gt;
&lt;P&gt;Please advise&lt;/P&gt;</description>
    <pubDate>Thu, 07 Dec 2023 16:46:16 GMT</pubDate>
    <dc:creator>kcvaldez98</dc:creator>
    <dc:date>2023-12-07T16:46:16Z</dc:date>
    <item>
      <title>Boxplot Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Boxplot-Help/m-p/906737#M40515</link>
      <description>&lt;P&gt;Hi SAS Coders!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a box plot that looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2023-12-07 at 9.43.09 AM.png" style="width: 679px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90945i166A42D5577C2702/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2023-12-07 at 9.43.09 AM.png" alt="Screen Shot 2023-12-07 at 9.43.09 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;My quartiles are out of order and I have tried everything. Here is my code for reference:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS NOPROCTITLE;
PROC SGPLOT DATA=WORK.FIGURE;
  VBOX outcomes_adults_mental_distr / 
    GROUPORDER = DATA  
    CATEGORY=Quartiles   
    FILLATTRS=(COLOR=LIGHTBLUE) BOXWIDTH=0.8;
  TITLE BOLD "Boxplot of Quartiles of Marijuana Use and Frequent Mental Distress";
  XAXIS DISPLAY=(NOLABEL) LABELATTRS=(WEIGHT=BOLD);
  YAXIS LABEL="Frequent Mental Distress" VALUES=(0 TO 100 BY 10) OFFSETMIN=0;
  XAXIS LABEL="Quartiles";
  REFLINE 70 / AXIS=Y LINEATTRS=(COLOR=BLUE);
  REFLINE 90 / AXIS=Y LINEATTRS=(COLOR=BLUE);
  YAXIS GRID;
  INSET "Data Source: Colorado Study Data"/ POSITION=NW BORDER;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How do I get it where it goes from "First Quartile, Second Quartile, Third Quartile and Fourth Quartile" ?&lt;/P&gt;
&lt;P&gt;Please advise&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 16:46:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Boxplot-Help/m-p/906737#M40515</guid>
      <dc:creator>kcvaldez98</dc:creator>
      <dc:date>2023-12-07T16:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Boxplot Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Boxplot-Help/m-p/906762#M40524</link>
      <description>&lt;P&gt;Formats will help here! You'll want to create a format and informat as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
	invalue invqrtl   'First Quartile'  = 1
			          'Second Quartile' = 2
				      'Third Quartile'  = 3
				      'Fourth Quartile' = 4;&lt;BR /&gt;&lt;BR /&gt;	value qrtl  1='First Quartile'
				2='Second Quartile'
				3='Third Quartile'
				4='Fourth Quartile';				
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The informat will allow you to convert your character variable Quartiles into a numeric variable&amp;nbsp;Quartiles_num which you'll use for the graph. Since it's numeric, the plot will automatically order these in the right order (1,2,3,4) and you'll apply format qrtl. to display these as "First Quartile", "Second Quartile",...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code you'll want to include in a data step to prep the data is as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ....;
        .....;
	    Quartiles_num=input(Quartiles,invqrtl.);
    	format Quartiles_num qrtl.;
        ....;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The only change to your PROC SGPLOT is to use&amp;nbsp;Quartiles_num instead of Quartiles.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 17:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Boxplot-Help/m-p/906762#M40524</guid>
      <dc:creator>antonbcristina</dc:creator>
      <dc:date>2023-12-07T17:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Boxplot Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Boxplot-Help/m-p/906765#M40526</link>
      <description>&lt;P&gt;Notice that the quartiles are in alphabetical order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While I would recommend use of an actual numeric value with a format as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/84234"&gt;@antonbcristina&lt;/a&gt; shows in the long run another approach would be to change the values to something like 1st Quartile, 2nd Quartile, 3rd Quartile and 4th Quartile. The order is still alphabetical but the order would be 1st 2nd 3rd 4th.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;GROUPORDER doesn't have much affect without a GROUP= variable.&lt;/P&gt;
&lt;P&gt;If your data is in quartile order for the Category variable you want the DISCRETEORDER option.&lt;/P&gt;
&lt;P&gt;Or use a different format for the variable to change the display order.&lt;/P&gt;
&lt;P&gt;From the documentation for VBOX&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="xis-eDocBody"&gt;
&lt;DIV class="xis-refProc"&gt;
&lt;DIV class="xis-procStatement"&gt;
&lt;DIV class="xis-procStatementSyntax"&gt;
&lt;DIV class="xis-syntaxDescription"&gt;
&lt;DIV class="xis-optionalArgGroup"&gt;
&lt;DIV id="p1juyzpgx5uk2bn1243nrsullj45" class="xis-argDescriptionPair"&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimple"&gt;The default ordering of the tick values is ascending formatted order of the &lt;SPAN class="xis-userSuppliedValue"&gt;category-variable&lt;/SPAN&gt;. To change this ordering, you can use the DISCRETEORDER=DATA option in the category axis statement&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 17:46:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Boxplot-Help/m-p/906765#M40526</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-12-07T17:46:26Z</dc:date>
    </item>
  </channel>
</rss>

