BookmarkSubscribeRSS Feed
LilyY_
Calcite | Level 5

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!

4 REPLIES 4
LilyY_
Calcite | Level 5

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!

MikeZdeb
Rhodochrosite | Level 12

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
Andre
Obsidian | Level 7

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

LilyY_
Calcite | Level 5

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1041 views
  • 0 likes
  • 3 in conversation