Proc sort & gplot

  • Follow


Hi,

I have a problem to sort a graph. The categorical variable trata is
not displayed for the proc gplot in alphabetical order. It seems proc
gplot has its own way to sort the data. Could you help me?

Thanks.

* Order data;
proc sort data=&entra.; by trata; run;

* Print graph;
ods listing;
proc gplot
data=&entra.;
   plot trata*estimate /
 
annotate=anno
   nolegend
  vaxis=axis1
  haxis=axis2
  noframe href = &linia. lhref = 20;
  format estimate
6.1;
run;
quit;
0
Reply miguelbcn 3/1/2011 8:29:06 AM

On Mar 1, 12:29=A0am, miguelbcn <miguelmo...@gmail.com> wrote:
> Hi,
>
> I have a problem to sort a graph. The categorical variable trata is
> not displayed for the proc gplot in alphabetical order. It seems proc
> gplot has its own way to sort the data. Could you help me?
>
> Thanks.
>
> * Order data;
> proc sort data=3D&entra.; by trata; run;
>
> * Print graph;
> ods listing;
> proc gplot
> data=3D&entra.;
> =A0 =A0plot trata*estimate /
>
> annotate=3Danno
> =A0 =A0nolegend
> =A0 vaxis=3Daxis1
> =A0 haxis=3Daxis2
> =A0 noframe href =3D &linia. lhref =3D 20;
> =A0 format estimate
> 6.1;
> run;
> quit;

Switch your xvar with yvar:

  plot estimate*trata / annotate=3Danno ...

The plot statement is for Y*X, not X*Y.

HTH

Ya
0
Reply Ya 3/1/2011 2:28:39 PM


On 1 mar, 15:28, Ya <huang8...@gmail.com> wrote:
> On Mar 1, 12:29=A0am, miguelbcn <miguelmo...@gmail.com> wrote:
>
>
>
>
>
> > Hi,
>
> > I have a problem to sort a graph. The categorical variable trata is
> > not displayed for the proc gplot in alphabetical order. It seems proc
> > gplot has its own way to sort the data. Could you help me?
>
> > Thanks.
>
> > * Order data;
> > proc sort data=3D&entra.; by trata; run;
>
> > * Print graph;
> > ods listing;
> > proc gplot
> > data=3D&entra.;
> > =A0 =A0plot trata*estimate /
>
> > annotate=3Danno
> > =A0 =A0nolegend
> > =A0 vaxis=3Daxis1
> > =A0 haxis=3Daxis2
> > =A0 noframe href =3D &linia. lhref =3D 20;
> > =A0 format estimate
> > 6.1;
> > run;
> > quit;
>
> Switch your xvar with yvar:
>
> =A0 plot estimate*trata / annotate=3Danno ...
>
> The plot statement is for Y*X, not X*Y.
>
> HTH
>
> Ya- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -

Thanks but the trata variable has to be Y.
0
Reply miguelbcn 3/1/2011 4:00:28 PM

On Mar 1, 8:00=A0am, miguelbcn <miguelmo...@gmail.com> wrote:
> On 1 mar, 15:28, Ya <huang8...@gmail.com> wrote:
>
>
>
>
>
> > On Mar 1, 12:29=A0am, miguelbcn <miguelmo...@gmail.com> wrote:
>
> > > Hi,
>
> > > I have a problem to sort a graph. The categorical variable trata is
> > > not displayed for the proc gplot in alphabetical order. It seems proc
> > > gplot has its own way to sort the data. Could you help me?
>
> > > Thanks.
>
> > > * Order data;
> > > proc sort data=3D&entra.; by trata; run;
>
> > > * Print graph;
> > > ods listing;
> > > proc gplot
> > > data=3D&entra.;
> > > =A0 =A0plot trata*estimate /
>
> > > annotate=3Danno
> > > =A0 =A0nolegend
> > > =A0 vaxis=3Daxis1
> > > =A0 haxis=3Daxis2
> > > =A0 noframe href =3D &linia. lhref =3D 20;
> > > =A0 format estimate
> > > 6.1;
> > > run;
> > > quit;
>
> > Switch your xvar with yvar:
>
> > =A0 plot estimate*trata / annotate=3Danno ...
>
> > The plot statement is for Y*X, not X*Y.
>
> > HTH
>
> > Ya- Ocultar texto de la cita -
>
> > - Mostrar texto de la cita -
>
> Thanks but the trata variable has to be Y.- Hide quoted text -
>
> - Show quoted text -

Then can you try sort by estimate and trata?
0
Reply Ya 3/1/2011 4:28:29 PM

On Mar 1, 5:00=A0pm, miguelbcn <miguelmo...@gmail.com> wrote:
> On 1 mar, 15:28, Ya <huang8...@gmail.com> wrote:
>
>
>
> > On Mar 1, 12:29=A0am, miguelbcn <miguelmo...@gmail.com> wrote:
>
> > > Hi,
>
> > > I have a problem to sort a graph. The categorical variable trata is
> > > not displayed for the proc gplot in alphabetical order. It seems proc
> > > gplot has its own way to sort the data. Could you help me?
>
> > > Thanks.
>
> > > * Order data;
> > > proc sort data=3D&entra.; by trata; run;
>
> > > * Print graph;
> > > ods listing;
> > > proc gplot
> > > data=3D&entra.;
> > > =A0 =A0plot trata*estimate /
>
> > > annotate=3Danno
> > > =A0 =A0nolegend
> > > =A0 vaxis=3Daxis1
> > > =A0 haxis=3Daxis2
> > > =A0 noframe href =3D &linia. lhref =3D 20;
> > > =A0 format estimate
> > > 6.1;
> > > run;
> > > quit;
>
> > Switch your xvar with yvar:
>
> > =A0 plot estimate*trata / annotate=3Danno ...
>
> > The plot statement is for Y*X, not X*Y.
>
> > HTH
>
> > Ya- Ocultar texto de la cita -
>
> > - Mostrar texto de la cita -
>
> Thanks but the trata variable has to be Y.

A character variable never cannot be used as the Y variable.
If you use a character variable as Y and have a numeric for X Proc
Gplot will silently switch them.
The order of the character variable on the X axis would be
alphabetical, regardless of the sorting.
The sorting will only be visible if you have a symbol statement that
connects the data points.

Frank Poppe
0
Reply Frank 3/2/2011 11:04:25 AM

4 Replies
389 Views

(page loaded in 0.002 seconds)

Similiar Articles:











7/23/2012 4:57:11 PM


Reply: