Data visualization with SAS programming

label for each fourth dot in gplot

Accepted Solution Solved
Reply
Contributor
Posts: 22
Accepted Solution

label for each fourth dot in gplot

Good day to all.

I'm newbie in SAS.
I need labeling each fourth dot like this: " was built in &year_of_release ".
&year - is a variable value that store in data set. My table has three values: year, year_of_release and freq.
Year (simple number like 2014) and freq3 (number like 0.00514554) are used in graph as X and Y.
Year_of_release (simple number like 2014) is used in graph as value for grouping.

There is my code (you can see that I tried to use a "pointlabel" option but it doesn't display an information that I need, it always show a "freq3" information for some reason):

                

%macro prognostic_graph;


goptions reset=all device=activex ypixels=600 xpixels=800;
  
;               
        
symbol1
  INTERPOL = join 
  VALUE = dot
  LINE = 1
  WIDTH = 1
  HEIGHT = 0.7
  POINTLABEL = ("#year_of_release");

;


Axis1

  STYLE = 0
  WIDTH = 0
  LABEL = (font="Arial/bold" a=90    Justify=center "Freq  ")  
  VALUE = (font="Arial" HEIGHT=9pt )    
  MINOR = none
  ORDER = (0 to 0.02 by 0.001)
  OFFSET = (0,0)

;   

Axis2 

                       
  ORDER = (2002 to 2018 by 1)
  STYLE = 0
  WIDTH = 0
  LABEL = (font="Arial/bold"    Justify=center "Years")  
  VALUE = (font="Arial" HEIGHT=9pt )
  COLOR = cx&gridColor
  MINOR = none                                    
  OFFSET = (0,0)
    ;
                               

                                                            
PROC GPLOT DATA=mergeDots;

  PLOT freq3 * year  = year_of_release  /
            VAXIS = AXIS1
            HAXIS = AXIS2
            NOFRAME                   
            GRID
            NOLEGEND
  ;
RUN;

        
%mend prognostic_graph;


Thank you for your attention.


Accepted Solutions
Solution
‎08-15-2014 08:11 AM
SAS Employee
Posts: 963

Re: label for each fourth dot in gplot

Try using device=png rather than device=activex.

The SAS/Graph device=activex implementation does not support all the customization features (such as pointlabel) fully.

View solution in original post


All Replies
Esteemed Advisor
Esteemed Advisor
Posts: 6,704

Re: label for each fourth dot in gplot

TBH I would strongly suggest moving away from GPLOT to SGPLOT at minimum or preferably proc template/GTL.  You will have far more control over outputs.  Have a look at this blog which has hundreds of examples of graphs with most options you could ever need, with example code generally in sgplot and GTL.

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

Contributor
Posts: 22

Re: label for each fourth dot in gplot

Thank you for your recomendation! I will be work with SGPLOT next time.

Solution
‎08-15-2014 08:11 AM
SAS Employee
Posts: 963

Re: label for each fourth dot in gplot

Try using device=png rather than device=activex.

The SAS/Graph device=activex implementation does not support all the customization features (such as pointlabel) fully.

Contributor
Posts: 22

Re: label for each fourth dot in gplot

Thank you, your comment decided my problem!

Post a Question
Discussion Stats
  • 4 replies
  • 340 views
  • 3 likes
  • 3 in conversation