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

Hi,

I'm new in SAS/GRAPH facility so I need small help with simple SAS graph:

DATA:

Date:          Time:

05.02.2013 10:01:29

14.02.2013 11:02:01

25.02.2013 10:10:16

03.03.2013 10:24:08

18.03.2013 9:27:40

18.03.2013 9:56:19

18.03.2013 12:18:50

01.04.2013 11:02:41

SAS code:

      symbol1 ci=Blue c=Red i=join v=dot  l=1 w=2;

      proc gplot data=&InTable;

            plot startTime*startDate=1/ AUTOHREF  AUTOVREF;

      run;

Result Graph in attached image.

So what I need is just mark last Graph node in Bold(or in another color etc.) else I'd like automatically add some label to this last Graph node , this label will have concattenated Date and Time value:"01.04.2013 11:02:41"

Thanks!


Graph.bmp
1 ACCEPTED SOLUTION

Accepted Solutions
AncaTilea
Pyrite | Level 9

hi.

the simplest way I know is to use a small annotate data set.

First you need to sort your data by startDate;

proc sort data = have;by startDate;run;

Then create the annotate data set, where you say if it is the last date then change the color:

data annotate;                                                                                                                             

   length function color $8 text $20;                                                                                                      

   retain xsys ysys '2' when 'a';                                                                                                       

   set have end = _last_;                                                                                                                   

       by startDate;                                                                                                                                

   function='symbol'; 

    xc = startDate

    y =  startTime;

   size=1.3;

   text='dot';

    color = 'blue';

                                                                                                                                     

  /* The symbol color is determined by the value of a variable. */                                                                       

   if (_last_) then do;

        color='green'; size = 2;

   end;

   output;                                                                                                                              

run;

      symbol1 ci=Blue c=Red i=join v=dot  l=1 w=2;

      proc gplot data= have;

            plot starttime*startDate=1/ AUTOHREF  AUTOVREF anno = annotate;

      run;quit;

Good luck!

Anca.

View solution in original post

2 REPLIES 2
AncaTilea
Pyrite | Level 9

hi.

the simplest way I know is to use a small annotate data set.

First you need to sort your data by startDate;

proc sort data = have;by startDate;run;

Then create the annotate data set, where you say if it is the last date then change the color:

data annotate;                                                                                                                             

   length function color $8 text $20;                                                                                                      

   retain xsys ysys '2' when 'a';                                                                                                       

   set have end = _last_;                                                                                                                   

       by startDate;                                                                                                                                

   function='symbol'; 

    xc = startDate

    y =  startTime;

   size=1.3;

   text='dot';

    color = 'blue';

                                                                                                                                     

  /* The symbol color is determined by the value of a variable. */                                                                       

   if (_last_) then do;

        color='green'; size = 2;

   end;

   output;                                                                                                                              

run;

      symbol1 ci=Blue c=Red i=join v=dot  l=1 w=2;

      proc gplot data= have;

            plot starttime*startDate=1/ AUTOHREF  AUTOVREF anno = annotate;

      run;quit;

Good luck!

Anca.

Yura2301
Quartz | Level 8

Hi Anca,

It's exactly what I need, thanks!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 808 views
  • 0 likes
  • 2 in conversation