Help using Base SAS procedures

How to put case count label in Proc Gplot

Reply
Occasional Contributor
Posts: 17

How to put case count label in Proc Gplot

Dear all,

I have a plot produced by proc gplot. I now need to add on the case count to each data point. There are multiple cases with same value. 

Does anyone know how to do this without creating new variables? I know I probably can do this by creating a new "count" variable and then use pointlabel.

Thanks in advance!

Occasional Contributor
Posts: 17

Re: How to put case count label in Proc Gplot

Or any other SAS procedures can create this type of line graph?

Basically, I have about 10+ time points, I want to graph out the mean value for each time point. Every time points may have from 1 to 100 cases.

Thanks!

Valued Guide
Posts: 765

Re: How to put case count label in Proc Gplot

hi ... there's most likely a nice looking SG solution too, but here's one for GPLOT ...

data test;

do x = 1 to 10;

   y = ceil(100*ranuni(0));

   output;

   if ranuni(0) lt .3 then output;

   if ranuni(0) lt .2 then output;

   if ranuni(0) lt .1 then output;

end;

run;

proc sql;

   create view xy as select x,y,count(*) as count from test group by x,y;

quit;

goptions reset=all ftext='calibri' htext=2 gunit=pct;

symbol1 v='6c'x f='wingdings' h=2 c=blue pointlabel=(c=blue "#count");

axis1 offset=(2,2)pct;

proc gplot data=xy;

plot y*x / haxis=axis1;

run;

quit;


xy_counts.png
Super Contributor
Posts: 273

Re: How to put case count label in Proc Gplot

With sgplot, Mike,   the minimal would be

ods graphics on;

proc sgplot data=xy;

scatter x=x y=y / datalabel=count  markerattrs=(symbol=circlefilled   color=blue);

run;

but i don't know yet if in sgplot the tickmarks are generated  by the data or if we could regulate them by program

xaxis grid values=(1 to 10 by 1);

could render better but is limited as i don't see the possibility for minor tickmarks

Andre

Occasional Contributor
Posts: 17

Re: How to put case count label in Proc Gplot

Thanks. Mike. This is what I did. I created a count variable and then use pointlabel.

Ask a Question
Discussion stats
  • 4 replies
  • 268 views
  • 0 likes
  • 3 in conversation