Prev: Excel Workbook Setting Error Message
Next: Do we need a NORETAIN statement? was: about full join problem
From: GuyA on 9 Dec 2009 07:50 Hi. Hopefully there's a simple solution to this... I have a dataset with a character variable ordered in a particular (non alphabetical) way which is the horizontal axis in a plot. PROC GPLOT totally ignores this ordering, and decides to be really "helpful" by ordering them alphabetically. Is there any way to specify something similar to ORDER=DATA, as in some other procedures? I know the AXIS statement can include a list of character strings to order the data, which would mean it would be quite simple to spit those values into a macro variable using PROC SQL and feed it in, but the problem here is that I'm the plotting is "by" something, and so this will end up being rather a complicated solution indeed... Any ideas? Thanks...
From: Rivo Ramamonjy on 9 Dec 2009 09:44 Hi, You should use your character value as the result of a format applied to another ordered variable X. Put the ordered variable X on the horizontal axis of the plot and apply a format that displays the character value : Example: proc format; value fmtplot 1='First' 2='Second' 3='Third' 4='Forth' 5='Fifth' ; run; data T; input X Y; datalines; 1 120 2 400 3 256 4 450 5 500 ; run; proc gplot data=T; plot Y*X; format X fmtplot.; run; You will see on the horizontal axis the values First, Second, Third, Forth, Fifth Rivo. -----Message d'origine----- De : SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] De la part de GuyA Envoy� : mercredi 9 d�cembre 2009 13:51 � : SAS-L(a)LISTSERV.UGA.EDU Objet : Character variables to order horizontal axis in GPLOT Hi. Hopefully there's a simple solution to this... I have a dataset with a character variable ordered in a particular (non alphabetical) way which is the horizontal axis in a plot. PROC GPLOT totally ignores this ordering, and decides to be really "helpful" by ordering them alphabetically. Is there any way to specify something similar to ORDER=DATA, as in some other procedures? I know the AXIS statement can include a list of character strings to order the data, which would mean it would be quite simple to spit those values into a macro variable using PROC SQL and feed it in, but the problem here is that I'm the plotting is "by" something, and so this will end up being rather a complicated solution indeed... Any ideas? Thanks...
From: GuyA on 9 Dec 2009 11:43
Thanks. I will use that method, if necessary. I am surprised that there is no way to override the automatic alphabet sort in GPLOT. I think this should be something SAS add to a future release... (eg: axis1 label=none order=data;) |