BookmarkSubscribeRSS Feed
Barkamih
Pyrite | Level 9

Hi all,

 

I'm using this code but the plots are not sorted properly as I have them in the original data. 

 

for example, the month of April came before January on the graph. 

 

So, in this case, how I could solve this out?

proc glm data = have;
  class month;
  model value = month-;
  run; quit; 

Thanks for your help 

 

Regards 

 

Ibrahim 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

April comes before January because the values on the plots are being sorted to have the levels in alphabetical order.

 

How is April identified in your data set HAVE? Is it the number 4, or is it the word "APRIL"? I suggest you might want to use numbers or actual SAS date values instead of the word "APRIL".

--
Paige Miller
Barkamih
Pyrite | Level 9

Greate, I already recognized this issue a few minutes ago and I changed them to numbers. 

 

now, everything going well 

 

Thanks for your response 

 

barkamih 

 

 

 

MichaelL_SAS
SAS Employee

You can use the ORDER= option in the PROC GLM statement to control how the levels of classification variables are ordered. The default ordering is by the formatted values, or internal values if no formats are provided. In this case that does put April before January. If your data are already sorted in the order of the variable Month that you want used, you can specify ORDER=DATA, in which case the variable levels are ordered how their appearance in the input data set. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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