BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sasadomo
Calcite | Level 5

Now I have a code that plots the cumulative return of firms from 1994 till now but I want to add number of observation that used to calculate the cumulative return at each time point. Some sample code:

 

options nodate orientation=landscape;
goptions device=pdfc; /*Plot Saved in Home Directory*/
ods pdf file=&locationin;
axis1 label=(angle=90 'Value of \$1 invested in a portfolio');
axis2 label=('Date');
symbol1 interpol =join ci =green w = 3 co =green;
symbol2 interpol =join ci =blue co =blue value =star;
proc gplot data =work.CumRet;
Title &titlein ;
plot top*date= 1 bottom*date= 2 / overlay legend vaxis=axis1 haxis=axis2;
run;quit;
ods pdf close;

Or, if my description is not clear enough, generally, how could I add the number of observation at each point of a curve plot? Given I have the number of observation variable. 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

First, move to proc splot and GTL, it is far more powerful, gplot is very old.  

Second, take a look through this blog which gives examples for almost any graph you want, and you will find examples of what you want:

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

 

What you want is datalabel:

https://blogs.sas.com/content/iml/2011/11/11/label-only-certain-observations-with-proc-sgplot.html

 

 

View solution in original post

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

First, move to proc splot and GTL, it is far more powerful, gplot is very old.  

Second, take a look through this blog which gives examples for almost any graph you want, and you will find examples of what you want:

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

 

What you want is datalabel:

https://blogs.sas.com/content/iml/2011/11/11/label-only-certain-observations-with-proc-sgplot.html

 

 

ballardw
Super User

@Sasadomo wrote:

Now I have a code that plots the cumulative return of firms from 1994 till now but I want to add number of observation that used to calculate the cumulative return at each time point. Some sample code:

 

Or, if my description is not clear enough, generally, how could I add the number of observation at each point of a curve plot? Given I have the number of observation variable. 


With Proc Gplot, annotate data set.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 2996 views
  • 2 likes
  • 3 in conversation