<?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: Line graphs: How to make values on X-axis appear in chronological order. in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Line-graphs-How-to-make-values-on-X-axis-appear-in-chronological/m-p/939264#M18184</link>
    <description>&lt;P&gt;You could try a custom sort for your category. Right click the data item on the Data pane and select Custom Sort,&lt;/P&gt;</description>
    <pubDate>Wed, 14 Aug 2024 15:07:42 GMT</pubDate>
    <dc:creator>Madelyn_SAS</dc:creator>
    <dc:date>2024-08-14T15:07:42Z</dc:date>
    <item>
      <title>Line graphs: How to make values on X-axis appear in chronological order.</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Line-graphs-How-to-make-values-on-X-axis-appear-in-chronological/m-p/939259#M18181</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;I'm creating a line graph to display longitudinal data for school years.&amp;nbsp; My x-axis variables are character values and I want them displayed in chronological order (2020-21 -&amp;gt; 2021-22 -&amp;gt; 2022-23).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now it is defaulting to showing the most recent years first to the left and the oldest data further to the right.&amp;nbsp; Is there a way to fix this?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="es_edu_0-1723646359955.png" style="width: 824px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99259i98C20C011D542430/image-dimensions/824x70?v=v2" width="824" height="70" role="button" title="es_edu_0-1723646359955.png" alt="es_edu_0-1723646359955.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 14:43:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Line-graphs-How-to-make-values-on-X-axis-appear-in-chronological/m-p/939259#M18181</guid>
      <dc:creator>es_edu</dc:creator>
      <dc:date>2024-08-14T14:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Line graphs: How to make values on X-axis appear in chronological order.</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Line-graphs-How-to-make-values-on-X-axis-appear-in-chronological/m-p/939261#M18182</link>
      <description>&lt;P&gt;Easiest to ensure chronological order is to use DATES.&lt;/P&gt;
&lt;P&gt;If that isn't possible (though should be) then numeric values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I deal with school year data where the reports want to see "year" values similar to your 2021-22.&lt;/P&gt;
&lt;P&gt;If the data is already summarized I use one of the values for year such as 2021 to represent the start of the "year". Then have a custom format to display the the value as 2021-22 as needed.&lt;/P&gt;
&lt;P&gt;So extract the first part that variable into a numeric with code in a data step like : yearnum = input(scan(yearvar,2,'-'),f4.);&lt;/P&gt;
&lt;P&gt;Then use this to create a format,&lt;/P&gt;
&lt;PRE&gt;data syearcontrol;
   fmtname = 'Syear';
   type = 'N';
   do start=1990 to 2200;
      label = catx('-',start,put( mod(start+1,100),z2.));
      output;
   end;
run;

proc format library=work cntlin=syearcontrol;
run;

/* test that the format was created and usable*/
data _null_;
  do year= 2000 to 2010;
    put year= syear.;
  end;
run;&lt;/PRE&gt;
&lt;P&gt;Use whatever you think useful in the Syearcontrol data step though having a couple hundred years more than you expect may not hurt just in case. Excercise for the interested reader to add a last observation with HLO set to 'O' with a label of "Out of range" or similar value.&lt;/P&gt;
&lt;P&gt;The last data step writes examples to the log for a small range of values.&lt;/P&gt;
&lt;P&gt;Use the Syear format as either the default for the variable or just for use in the graph.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: you will need to either recreate the format each session you want to use it OR place the format into a permanent library that your FMTSEARCH SAS system option sees.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 15:00:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Line-graphs-How-to-make-values-on-X-axis-appear-in-chronological/m-p/939261#M18182</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-14T15:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Line graphs: How to make values on X-axis appear in chronological order.</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Line-graphs-How-to-make-values-on-X-axis-appear-in-chronological/m-p/939264#M18184</link>
      <description>&lt;P&gt;You could try a custom sort for your category. Right click the data item on the Data pane and select Custom Sort,&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 15:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Line-graphs-How-to-make-values-on-X-axis-appear-in-chronological/m-p/939264#M18184</guid>
      <dc:creator>Madelyn_SAS</dc:creator>
      <dc:date>2024-08-14T15:07:42Z</dc:date>
    </item>
  </channel>
</rss>

