Desktop productivity for business analysts and programmers

Graphics using the lsmeans of proc glimmix

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Graphics using the lsmeans of proc glimmix

[ Edited ]

Hello everyone!
I have a longitudinal data base and I created one graphics using the Lsmeans of Proc Glimmix (using the Enterprise guide).
However, the axis "x" didn't result in a correct order (Firstly the SAS got the output 'D10' folling 'D7', 'D8' and 'D9')
However, I am trying to organize the axes "x" in a respective order: 'D7', 'D8', 'D9', and 'D10'.
How can I do that?
I will be really grateful if someone could help-me!!!
Best regards,
Rodolfo Mingoti.
 


Accepted Solutions
Solution
‎04-09-2018 02:48 PM
Super User
Posts: 13,889

Re: Graphics using the lsmeans of proc glimmix

Posted in reply to Rodolfo_Mingoti

That is the order character data will sort. Character sorting goes character by character left to right. And since "1" is less than "2", "3" or other character digits except "0"m "10" comes before "2".

 

Since the graphics options in most of the analysis procedures have limited appearance control options your have limited choices. One is creating a variable that will sort as required. The other is to export the data to a data set and plot with a procedure like SGPLOT where you have options to control and axis with the XAXIS statement such as a value list where you can explicitly order variable.

View solution in original post


All Replies
Super User
Posts: 10,530

Re: Graphics using the lsmeans of proc glimmix

Posted in reply to Rodolfo_Mingoti

Please do not post Excel files (unless your problem lies in importing those).

Use the macro provided in https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to create a data step from your dataset, and post the resulting code here as advised in https://communities.sas.com/t5/help/faqpage/faq-category-id/posting#posting.

 

Are you sure your post should stay in Enterprise Guide, or should I move it to the SAS Statistical Procedures forum?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Super User
Posts: 9,799

Re: Graphics using the lsmeans of proc glimmix

Posted in reply to Rodolfo_Mingoti

Yes, it is sorting the text items.  Simplest way of getting round this is to create a format:

proc format;
  value days
    1="D1"
    2="D2"
    ...
    10="D10";
run;
data yourdata;
  set yourdata;
  format xaxisvariable days.;
run;

So I don't know your data as not opening an excel file, but I assume you have a variable which is used on the Xaxis, make this a number, with just the number of the day, e.g. 1, 2 etc.  Then apply the format which will display the data as D1, D2 etc.  This way the data will sort correctly on the Xaxis and display per the format.

Solution
‎04-09-2018 02:48 PM
Super User
Posts: 13,889

Re: Graphics using the lsmeans of proc glimmix

Posted in reply to Rodolfo_Mingoti

That is the order character data will sort. Character sorting goes character by character left to right. And since "1" is less than "2", "3" or other character digits except "0"m "10" comes before "2".

 

Since the graphics options in most of the analysis procedures have limited appearance control options your have limited choices. One is creating a variable that will sort as required. The other is to export the data to a data set and plot with a procedure like SGPLOT where you have options to control and axis with the XAXIS statement such as a value list where you can explicitly order variable.

New Contributor
Posts: 2

Re: Graphics using the lsmeans of proc glimmix

Thanks ballardw, the problem has been solved!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 211 views
  • 2 likes
  • 4 in conversation