Data visualization with SAS programming

how to do annotation in proc sgplot

Reply
Contributor VRD
Contributor
Posts: 33

how to do annotation in proc sgplot

I am using proc sgplot to get mean and SE plot.

I need to annotate so that i want to know number of subjects for each visit. this should be coming below the X-axis.

SAS Super FREQ
Posts: 925

Re: how to do annotation in proc sgplot

I wrote a paper a while back called "Now You Can Annotate Your Statistical Graphics Procedure Graphs" (http://support.sas.com/resources/papers/proceedings11/277-2011.pdf) that contains examples for creating output similar to your needs. The SG procedure annotation facility requires at least SAS 9.3. Let me know if you can't find an example that works for you, or if you have an questions.

Contributor VRD
Contributor
Posts: 33

Re: how to do annotation in proc sgplot

Hi,

I didnt get the type of graph i find. i created a program like below but not bale to assemble the Number of subjects properly.

data anno(drop=n visit_1);

    set numb;

    function='text';

    x1space='datavalue';

    y1space='graphpercent';

    label=put(n,3.);

    anchor='center';

    x1=_n_;

    y1=input(visit_1,3.);

run;

proc sgplot data=test2 noautolegend sganno=anno pad=(bottom=12%);

   highlow x=visit_1 high=high low=low / highcap=serif lowcap=serif highlabel=label;

   scatter x=visit_1 y=mean / group=visit_1 groupdisplay=cluster;

   refline 10/axis=X;

   Yaxis values=(0 to 18 by 2) label="Dose";

   Xaxis label="Number shown in the graph is Number of Subjects in that Particular Visit";

run;

Respected Advisor
Posts: 3,788

Re: how to do annotation in proc sgplot

include the data with your program so we can see what it does.

Contributor VRD
Contributor
Posts: 33

Re: how to do annotation in proc sgplot

test2 dataset -----visit_1,  mean,  high  ,low,   label are the variables with any values

num dataset ---- visit_1 number of subjects

Contributor VRD
Contributor
Posts: 33

Re: how to do annotation in proc sgplot

test2 dataset

visit_1meanhighlow
12120
23127
34135
45132
51131
661541
72123
83115
94166
105137

numb dataset

visit_1number of subjects
12
23
34
45
51
66
72
83
94
10

5

with my code above i was trying to display number of subjects below the X-axis

Super User
Super User
Posts: 7,720

Re: how to do annotation in proc sgplot

This excellent blog gives you examples on pretty much everything 9.3/9.4 SGPLOT/GTL.

http://blogs.sas.com/content/graphicallyspeaking/

Respected Advisor
Posts: 3,788

Re: how to do annotation in proc sgplot

You may not need the "SG annotate facility" to achieve something as simple as a table of Ns.  I have done this with BLOCKPLOT statement and there is a new XAXISTABLE statement that seems even better but I have not used that.

Look at the examples in the blogs before you do anything too drastic. Smiley Happy

Contributor VRD
Contributor
Posts: 33

Re: how to do annotation in proc sgplot

XAXIS table is available for 9.4. I am using 9.3 version

Ask a Question
Discussion stats
  • 8 replies
  • 1111 views
  • 0 likes
  • 4 in conversation