Help using Base SAS procedures

what is the graphing procedure

Reply
Frequent Contributor
Posts: 110

what is the graphing procedure

hi all,

in proc gplot i have one doubt

i attached one graph in rtf file. see that

x;5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100

y;1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

the data is like this. this is i have to plot on a graph

AXIS1 LABEL=('Cumulative of employees');

AXIS2 LABEL=(ANGLE=90 'Cumulative of salaries);

PROC GPLOT DATA=ds;

PLOT Y*X /HAXIS=AXIS1  VAXIS=AXIS2;

RUN;

QUIT;

x-axis employees

y-axis salaries informatio

PLOT procedure all y are plotted on graph depend on x values. the graph is ok.

but my requirement is that i want to emphasis on  50 and 75 values on y axis. i.e. some mart tick on these points 50 and 75.

graph is appeared but points are not appeared only 50 and 75 points are appeared with some emphasis on it. some color

taking y values  1 to 20 . But only x values represent 50 and 75 in over all graph. and emphasis on this points with some color  or mark for understanding purpose these two are maximum.

how to do this can any one suggest me

thanks in advance.

1

Message was edited by: ravikumar kummari

Attachment
Super User
Super User
Posts: 7,392

Re: what is the graphing procedure

Hi,

My suggestion is to move from gplot (old tech) to sgplot and graph template language which will be the tech going forward.  These allow you far more control over your outputs and link in with all the other ods goodness as well.  If you need examples have a look at this blog which gives detailed examples of pretty much every graph imaginable: http://blogs.sas.com/content/graphicallyspeaking/

Frequent Contributor
Posts: 110

Re: what is the graphing procedure

I am not aware of proc sgplot and i searched in your link but the curve information is not available.

if you don't mind could you please post the answer how this is done.

thanks

Super User
Super User
Posts: 7,392

Re: what is the graphing procedure

Proc sgplot has been around since at least version 9.0.  It was brought in to replace gplot as it allows more flexibility and interaction with templates and ods.  The plot you are talking about is called a series plot, and examples can be found here:

proc sgplot example (second code snippet): http://blogs.sas.com/content/graphicallyspeaking/?s=sgplot+series

GTL example: http://blogs.sas.com/content/graphicallyspeaking/2014/04/27/multi-group-series-plots/

Frequent Contributor
Posts: 110

Re: what is the graphing procedure

yours links are good and useful. there is a huge information in links.

Definitely i will refer your links. But not now. If you know the answer of my post please comment.

Thanks in advance.

Super User
Posts: 10,460

Re: what is the graphing procedure

I'm not quite sure about what type of emphasis you want. You could draw horizontal lines across the graph from the Y values of 50 and 100 with

PLOT Y*X /HAXIS=AXIS1  VAXIS=AXIS2

                    HRef=(50,100)

;

Since your example graph shows no values of 200 and 300 there's nothing to suggest.

If you want to restrict which points are displayed then you could use datasets options

PROC GPLOT DATA=ds (where=(50 le x le100)) ;

A third variable to group responses such as

plot x*y=group will change the appearance of markers and lines for those points but data order and other considerations come in that require more specific information about your data and what you need.

without knowing what kind of emphasis is desired hard to help much more.

Frequent Contributor
Posts: 110

Re: what is the graphing procedure

You are not understand my point i think.

i want the output like the graph what ever i shown in ms word appear as it is there is no changes in that. the major change is that there is dot(.)  points to all Y values so instead of all values displaying only 50 and 75 points in graph.The graph as usual shown what ever it is.

SAS Super FREQ
Posts: 8,739

Re: what is the graphing procedure

Hi:

  No matter which technology you use: SAS/GRAPH and PROC GPLOT or ODS GRAPHICS and SGPLOT, each method of making a graph will produce an image. If you need "extra" emphasis on the image or extra reference lines or some modification to the tick marks then you have 2 ways to accomplish what you want:

1) research your method to see if there is a procedure statement or global statement to do what you want OR

2) add your own annotations to the graph. Both methods of doing graphs have ANNOTATE capabilities.

  The SG Procedures were first production in SAS version 9.2 and the ANNOTATE facility for the SG Procedures have been production since SAS 9.3. In addition, there is a separate forum for graphing questions that is a better place to ask your question. In one of your posts, you said that "i want to emphasis on  50 and 100 values on y axis. i.e. some mart tick on these points 50 and 75." and to me, this either means you want to draw an extra reference line at 50 and 100, which is possible with either graph method (look up reference lines) or you want to do something like draw an arrow pointing to 50 and an arrow pointing to 100, which is possible with ANNOTATE.

cynthia

Frequent Contributor
Posts: 110

Re: what is the graphing procedure

please comment.

what my requirement is that i want to display only two points on y axis.

i.e. 50 and 75. along with total graph.

i clearly mentioning here along with graph no need all points on graph. only 50 and 75 points appeared on graph.

any help would be much appreciated.

Frequent Contributor
Posts: 110

Re: what is the graphing procedure

how to control the midpoints in proc gplot

SAS Super FREQ
Posts: 8,739

Re: what is the graphing procedure

Hi, the reason I didn't really focus on your Word document was that your X axis went to 10000 and your Y axis went from 0 to 100. But with your sample data, your Y values only went from 1 to 20 and your X values were from 5 to 100, so It seems like your sample data could not have been used to make the graph in your Word document.

  The way to control the tick marks is through your AXIS statement. You are only using your AXIS statement for labels, but it has many, many ways for you to tailor the way the AXIS looks. Or, depending on the level of control you want, as I said in my previous posting, you might have to look at using ANNOTATE to put your own custom tick marks.

cynthia

Frequent Contributor
Posts: 110

Re: what is the graphing procedure

how to do the same process using proc sgplot.

i tried some code using proc sgplot.

data Class;

set YEAR_2010;

Label = Y;

if Y  NOT in (50,75) then

   Label = " ";

run;

proc sgplot data=CLASS;

   title 'Highlight a Value on a Graph';

   series x=X y=Y;

   scatter x=X y=Y /DATALABEL=LABEL;

   run;

here what happen i am getting the result but all points are displaying in graph.

what my requirement is that i want to display only two points on graph. i.e. 50 and 75 on y-AXIS,

Ask a Question
Discussion stats
  • 11 replies
  • 419 views
  • 0 likes
  • 4 in conversation