<?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 I am sorting my sgplot with cohortn and cohort but only want to display cohort information in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985802#M25872</link>
    <description>&lt;P&gt;&lt;STRONG&gt;tcddn is values like 1,2,3,4 for 4 cohorts, tcddn is something i want to display which is 9.2, 5, 1, 2.3 but they are not in numerical order. how do i resolve it? i don't want to display tcddn value in plot but want to order it by tcddn.&lt;/STRONG&gt;&lt;BR /&gt;data combo1;&lt;BR /&gt;merge combo (in=a) want(in=b);&lt;BR /&gt;by subjid tcddn tcdd retestcd nu month;&lt;BR /&gt;if b;&lt;BR /&gt;keep subjid restresn month tcddn tcdd nu;&lt;BR /&gt;proc sort; by tcddn tcdd subjid nu month;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data= combo1;&lt;BR /&gt;xaxis grid type= discrete discreteorder= data;&lt;BR /&gt;series x = month y= RESTRESN/ group=subjid grouporder= data;&lt;BR /&gt;scatter x=month y= RESTRESN/ group= subjid grouporder=data ;&lt;BR /&gt;xaxis label= 'Month';&lt;BR /&gt;yaxis label= 'ppFEV1 (%)'&lt;BR /&gt;values=(30 to 110 by 10);&lt;BR /&gt;by tcdd;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Apr 2026 20:43:24 GMT</pubDate>
    <dc:creator>dsam</dc:creator>
    <dc:date>2026-04-01T20:43:24Z</dc:date>
    <item>
      <title>I am sorting my sgplot with cohortn and cohort but only want to display cohort information</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985802#M25872</link>
      <description>&lt;P&gt;&lt;STRONG&gt;tcddn is values like 1,2,3,4 for 4 cohorts, tcddn is something i want to display which is 9.2, 5, 1, 2.3 but they are not in numerical order. how do i resolve it? i don't want to display tcddn value in plot but want to order it by tcddn.&lt;/STRONG&gt;&lt;BR /&gt;data combo1;&lt;BR /&gt;merge combo (in=a) want(in=b);&lt;BR /&gt;by subjid tcddn tcdd retestcd nu month;&lt;BR /&gt;if b;&lt;BR /&gt;keep subjid restresn month tcddn tcdd nu;&lt;BR /&gt;proc sort; by tcddn tcdd subjid nu month;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data= combo1;&lt;BR /&gt;xaxis grid type= discrete discreteorder= data;&lt;BR /&gt;series x = month y= RESTRESN/ group=subjid grouporder= data;&lt;BR /&gt;scatter x=month y= RESTRESN/ group= subjid grouporder=data ;&lt;BR /&gt;xaxis label= 'Month';&lt;BR /&gt;yaxis label= 'ppFEV1 (%)'&lt;BR /&gt;values=(30 to 110 by 10);&lt;BR /&gt;by tcdd;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2026 20:43:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985802#M25872</guid>
      <dc:creator>dsam</dc:creator>
      <dc:date>2026-04-01T20:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: I am sorting my sgplot with cohortn and cohort but only want to display cohort information</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985804#M25873</link>
      <description>&lt;P&gt;What do you get if you change your sort this way?&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc sort; by tcdd month tcddn;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2026 20:57:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985804#M25873</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2026-04-01T20:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: I am sorting my sgplot with cohortn and cohort but only want to display cohort information</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985806#M25874</link>
      <description>I tried it, but month which is not numeric variable, order is messed up on x axis.</description>
      <pubDate>Wed, 01 Apr 2026 21:51:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985806#M25874</guid>
      <dc:creator>dsam</dc:creator>
      <dc:date>2026-04-01T21:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: I am sorting my sgplot with cohortn and cohort but only want to display cohort information</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985807#M25875</link>
      <description>&lt;P&gt;In that case, I would create a numeric column with values 1 to 12 mapping to the correct month. Then, use a user-defined format to map the value back to the string name.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2026 22:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985807#M25875</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2026-04-01T22:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: I am sorting my sgplot with cohortn and cohort but only want to display cohort information</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985811#M25876</link>
      <description>&lt;P&gt;That would be very helpful if you could post some dummy data and desired output to display the issue you are running into.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
call streaminit(123);
do tcddn=1 to 4;
 do subjid=1 to 2;
   do month=1 to 12;
     RESTRESN=rand('normal');output;
   end;
  end;
end;
run;

proc format;
value fmt
1='   9.2'
2='  5'
3=' 1'
4='2.3'
;

data combo1;
 set have;
 tcdd=put(tcddn,fmt8.);
run;
proc sort data=combo1;
by tcdd;
run;

option nobyline;
title "tcdd=#byval1";
 proc sgplot data= combo1;
xaxis grid type= discrete discreteorder= data;
series x = month y= RESTRESN/markers group=subjid grouporder= data;
xaxis label= 'Month';
yaxis label= 'ppFEV1 (%)';
by tcdd;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Apr 2026 06:21:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985811#M25876</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2026-04-02T06:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: I am sorting my sgplot with cohortn and cohort but only want to display cohort information</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985821#M25877</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/448003"&gt;@dsam&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I tried it, but month which is not numeric variable, order is messed up on x axis.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Important concept: months and any calendar information in SAS data sets should be stored in NUMERIC variables. In fact, let me say that even more strongly:&amp;nbsp;any calendar information in SAS data sets MUST be stored in NUMERIC variables. Character variables &lt;EM&gt;will not&lt;/EM&gt; sort in the desired order for calendar information.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2026 11:45:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985821#M25877</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2026-04-02T11:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: I am sorting my sgplot with cohortn and cohort but only want to display cohort information</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985825#M25878</link>
      <description>&lt;P&gt;This does not look like it has anything to do with what PROC you are trying to run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your BY statements do not line up.&lt;/P&gt;
&lt;P&gt;You sorted by&amp;nbsp;&lt;SPAN&gt;tcddn tcdd&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;But told the PROC to process by tcdd.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Two choices.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Add the NOTSORTED keyword to the second BY statement to tell the PROC that the groups are grouped, but not sorted.&lt;/LI&gt;
&lt;LI&gt;Add TCDDN to the second BY statement, but set the NOBYLINE option and use the #BYVAL() tags in the title statement to reference the value of TCDD where ever you want to place it in the TITLE.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2026 13:47:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/I-am-sorting-my-sgplot-with-cohortn-and-cohort-but-only-want-to/m-p/985825#M25878</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-04-02T13:47:11Z</dc:date>
    </item>
  </channel>
</rss>

