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.
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.
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?
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.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.