<?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: Ordering sequence X-axis in SGPLOT in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41590#M5656</link>
    <description>As for the axis ordering, your can specify data ordering for the axis.  If you pre-sort your data, you can use the DISCRETEORDER=DATA option on the XAXIS statement to prevent the alphabetical sort of the axis.</description>
    <pubDate>Wed, 29 Jul 2009 15:59:52 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2009-07-29T15:59:52Z</dc:date>
    <item>
      <title>Ordering sequence X-axis in SGPLOT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41584#M5650</link>
      <description>Hello all; &lt;BR /&gt;
I would like to know more about how to modify the ordering sequence in the X-axis output statement? &lt;BR /&gt;
&lt;BR /&gt;
Currently I have the X-axis sequence as 2007Q1 2007Q2 etc etc. However I have been asked to use Jan-March 2007 vs 2007Q1. However, when I attempt to use vbar to graph it then alphabetizes so instead of getting:&lt;BR /&gt;
&lt;BR /&gt;
Jan-March 2007 Apr-Jun2007 Jan-March2008 I get:&lt;BR /&gt;
Jan-March 2007  Jan-March2008 Apr-Jun2007 &lt;BR /&gt;
&lt;BR /&gt;
Also on more question-Is there a way in within the X-axis to use ODS special characters such as /n so that I can relay additional informational such that: &lt;BR /&gt;
&lt;BR /&gt;
Jan-March 2007&lt;BR /&gt;
a=n&lt;BR /&gt;
b=n&lt;BR /&gt;
c=n&lt;BR /&gt;
&lt;BR /&gt;
I know I am asking a tall order but any help would be greatly appreciated as I cannot find anything in SAS documentation.&lt;BR /&gt;
&lt;BR /&gt;
Lawrence</description>
      <pubDate>Fri, 05 Jun 2009 17:03:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41584#M5650</guid>
      <dc:creator>_LB</dc:creator>
      <dc:date>2009-06-05T17:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering sequence X-axis in SGPLOT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41585#M5651</link>
      <description>Hi:&lt;BR /&gt;
  With the SG procedures, you can specify an INSET statement, which is where I would tend to put the count information, instead of into the legend. It may be a moot point, because I believe that the ODS ESCAPECHAR functions like {unicode} will work in the legend, but not functions like the new line function.&lt;BR /&gt;
&lt;BR /&gt;
  Documentation for the KEYLEGEND statement is here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/discrete-stmt.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/discrete-stmt.htm&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
  Documentation for the INSET statement is here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/inset-stmt.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/inset-stmt.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
An example of naming a plot and then generating a legend for that plot is shown here: &lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003155743.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003155743.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Note the legendlabel= option and the name= option and how they work together with the keylegend specification.&lt;BR /&gt;
  &lt;BR /&gt;
When I order date variables, even if I have a character variable, as you do for grouping, I generally sort by the date order before the graph step and then use ORDER=DATA or some option like that. For SGPLOT, the option is DISCRETEORDER=DATA. Rather than use a format, I generally make a character variable, that way, I don't have to remember to keep the format around everywhere.&lt;BR /&gt;
   &lt;BR /&gt;
cynthia&lt;BR /&gt;
                               &lt;BR /&gt;
[pre]&lt;BR /&gt;
proc format;&lt;BR /&gt;
   value mfmt &lt;BR /&gt;
         "01Jan08"d, "01Feb08"d, "01Mar08"d = "Jan-Mar 08"&lt;BR /&gt;
         "01Apr08"d, "01May08"d, "01Jun08"d = "Apr-Jun 08"&lt;BR /&gt;
         "01Jul08"d, "01Aug08"d, "01Sep08"d = "Jul-Sep 08"&lt;BR /&gt;
         "01Oct08"d, "01Nov08"d, "01Dec08"d = "Oct-Dec 08"&lt;BR /&gt;
         "01Jan09"d, "01Feb09"d, "01Mar09"d = "Jan-Mar 09"&lt;BR /&gt;
         "01Apr09"d, "01May09"d, "01Jun09"d = "Apr-Jun 09";&lt;BR /&gt;
run;&lt;BR /&gt;
                                         &lt;BR /&gt;
data Clinic_Stats;&lt;BR /&gt;
  length month $5 Clinic $11;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input monyy : monyy5. num_surg tot_pts Clinic $;&lt;BR /&gt;
  mgrp = put(monyy,mfmt.);&lt;BR /&gt;
  format monyy monyy5.;&lt;BR /&gt;
  label mgrp = 'Month'&lt;BR /&gt;
        monyy = 'Month'&lt;BR /&gt;
        num_surg = 'Number Surgeries'&lt;BR /&gt;
        tot_pts = 'Total Patients'&lt;BR /&gt;
        Contact_Resp = 'Respiratory Therapy Avg Time'&lt;BR /&gt;
        Clinic = 'Clinic';&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
JAN08 50 838   Main&lt;BR /&gt;
FEB08 44 903   Main&lt;BR /&gt;
MAR08 61 809   Main&lt;BR /&gt;
APR08 53 489   Main&lt;BR /&gt;
MAY08 53 249   Main&lt;BR /&gt;
JUN08 40 285   Main&lt;BR /&gt;
JUL08 41 242   Main&lt;BR /&gt;
AUG08 57 292   Main&lt;BR /&gt;
SEP08 49 298   Main&lt;BR /&gt;
OCT08 63 497   Main&lt;BR /&gt;
NOV08 64 920   Main&lt;BR /&gt;
DEC08 62 907   Main&lt;BR /&gt;
JAN09 67 854   Main&lt;BR /&gt;
FEB09 68 896   Main&lt;BR /&gt;
MAR09 75 865   Main&lt;BR /&gt;
APR09 74 876   Main&lt;BR /&gt;
;&lt;BR /&gt;
RUN;&lt;BR /&gt;
                                              &lt;BR /&gt;
proc sort data=clinic_stats out=clinic_stats;&lt;BR /&gt;
  by monyy;&lt;BR /&gt;
run;&lt;BR /&gt;
                                   &lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc sgplot data=clinic_stats;&lt;BR /&gt;
  vbar mgrp / datalabel stat=sum freq=num_surg;&lt;BR /&gt;
  title 'SGPLOT -- vbar ordered line and inset';&lt;BR /&gt;
  xaxis label = 'Month' fitpolicy=stagger type=discrete&lt;BR /&gt;
        discreteorder=data;&lt;BR /&gt;
  yaxis label = 'Total Surgeries' values=( 0 to 225 by 25);&lt;BR /&gt;
  inset (" Jan08 " = " 838" " Feb08 " = " 903" " Jan09 "=" 854") / &lt;BR /&gt;
        border&lt;BR /&gt;
        title='Patients' position=topright&lt;BR /&gt;
        textattrs=GraphLabelText;&lt;BR /&gt;
run;&lt;BR /&gt;
                                 &lt;BR /&gt;
proc sgplot data=clinic_stats;&lt;BR /&gt;
  vbar mgrp / group=monyy datalabel stat=sum freq=num_surg;&lt;BR /&gt;
  title 'SGPLOT -- Grouped vbar ordered line and inset';&lt;BR /&gt;
  xaxis label = 'Month' fitpolicy=stagger type=discrete&lt;BR /&gt;
        discreteorder=data;&lt;BR /&gt;
  yaxis label = 'Total Surgeries' values=( 0 to 225 by 25);&lt;BR /&gt;
  inset (" Jan08 " = " 838" " Feb08 " = " 903" " Jan09 "=" 854") / &lt;BR /&gt;
        border&lt;BR /&gt;
        title='Patients' position=topright&lt;BR /&gt;
        textattrs=GraphLabelText;&lt;BR /&gt;
run;&lt;BR /&gt;
                            &lt;BR /&gt;
[/pre]</description>
      <pubDate>Sat, 06 Jun 2009 16:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41585#M5651</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-06-06T16:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering sequence X-axis in SGPLOT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41586#M5652</link>
      <description>Cynthia;&lt;BR /&gt;
Thanks for the post. Helps immensely. While we are on the subject-&lt;BR /&gt;
it appears that the datalabel option does not appear to work with vbar although according to SAS there is that option. &lt;BR /&gt;
&lt;BR /&gt;
What I would like to do is plot a rate for example but have the underlying frequency reported as well. &lt;BR /&gt;
Ex:  20.0 Rate per 100 surgeries but only 1 SSI so it plots the rate but has n=1 printed on the top or side.&lt;BR /&gt;
This can be accomplished with the series option but not the vline or vbar option. &lt;BR /&gt;
I would be interested if this can be accomplished with vline or vbar.&lt;BR /&gt;
&lt;BR /&gt;
Thank you again.&lt;BR /&gt;
Lawrence</description>
      <pubDate>Mon, 08 Jun 2009 17:02:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41586#M5652</guid>
      <dc:creator>_LB</dc:creator>
      <dc:date>2009-06-08T17:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering sequence X-axis in SGPLOT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41587#M5653</link>
      <description>Hi:&lt;BR /&gt;
  DATALABEL works for me with VBAR. I'm working with SAS 9.2 Phase 2.  I believe there were some statements that were not fully implemented in 9.2 Phase 1 (or "classic" version).&lt;BR /&gt;
 &lt;BR /&gt;
  For help with the SG procedures, your best bet is to work with Tech Support, as they can get to the "SG" developers if you have a question that they can't address.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 08 Jun 2009 17:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41587#M5653</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-06-08T17:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering sequence X-axis in SGPLOT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41588#M5654</link>
      <description>Cynthia;&lt;BR /&gt;
Datalabels do work with Vline but not with Vbar. I will consult with tech support on this issue.&lt;BR /&gt;
Thank you again for your help!&lt;BR /&gt;
Lawrence</description>
      <pubDate>Mon, 08 Jun 2009 18:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41588#M5654</guid>
      <dc:creator>_LB</dc:creator>
      <dc:date>2009-06-08T18:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering sequence X-axis in SGPLOT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41589#M5655</link>
      <description>Hi:&lt;BR /&gt;
In 9.2 Phase 2, I can make my code and the DATALABEL option work. I did not try DATALABEL=variable. But the simple DATALABEL option -does- work with VBAR.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 08 Jun 2009 18:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41589#M5655</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-06-08T18:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering sequence X-axis in SGPLOT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41590#M5656</link>
      <description>As for the axis ordering, your can specify data ordering for the axis.  If you pre-sort your data, you can use the DISCRETEORDER=DATA option on the XAXIS statement to prevent the alphabetical sort of the axis.</description>
      <pubDate>Wed, 29 Jul 2009 15:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Ordering-sequence-X-axis-in-SGPLOT/m-p/41590#M5656</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2009-07-29T15:59:52Z</dc:date>
    </item>
  </channel>
</rss>

