BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
radha009
Quartz | Level 8

i have table as below, How to change the order to display in month order

 

Table:

 

input Affected_CI count;
datalines;
'54JFY5 Prtfolios ledger -  January'    10
'54JFY5 Prtfolios ledger -  February'    17
'66ABC5 Fund Data Correction -  -March'    7;
run;

 

result as below:

st.jpg

 

 

 

expecting in order January,February and march x-as order.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
radha009
Quartz | Level 8

resolved by adding

 

xaxis display=(nolabel) discreteorder=data;

View solution in original post

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You can use the search bar on the main page to search for topics similar to your question.

https://communities.sas.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=false&...

 

The simplest method is to change the xaxis values to be numbers, and to that field apply a format, so the data sorts per number and displays the formatted version:

proc format;
  value t 
    1='54JFY5 Prtfolios ledger -  January' 
    2='54JFY5 Prtfolios ledger -  February'
    3='66ABC5 Fund Data Correction -  -March';
run;

data inter;
  set have;
  if affected_ci='54JFY5 Prtfolios ledger -  January' then xasxisvar=1;
  if ...;
  format xaxisvar t.;
run;

Then use xaxisvar on your xaxis.

radha009
Quartz | Level 8

The app names are not constant.they are generated on different queries.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Then dynamically create the proc format step.

data _null_;
  set your_query_results end=last;
  if _n_=1 then call execute('proc format; value t ');
call execute(strip(put(_n_,best.),'=',strip(quote(query_result_text)," ");
if last then call execute(';run;');
run;

I can only answer what is provided.

ballardw
Super User

An alternate approach would be have an actual DATE value for the xaxis (fixes the sort issue) using an appropriate format for the display and then have a separate variable, possibly fund, that contains the other text like "54JFY5 Prtfolios ledger" and use that as a group variable and groupdisplay=cluster.

Yes this would move some of the information from the Axis to a Legend. Depending on the values involved that may be easier to manage long values.

 

I have to say that having the same color appear for two apparently unrelated data bits

54JFY5 Prtfolios ledger and 66ABC5 Fund Data Correction is really confusing.

radha009
Quartz | Level 8

resolved by adding

 

xaxis display=(nolabel) discreteorder=data;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 8676 views
  • 3 likes
  • 3 in conversation