Data visualization with SAS programming

Missing Line on the Dots for few cases - SAS GPLOT

Accepted Solution Solved
Reply
Contributor
Posts: 40
Accepted Solution

Missing Line on the Dots for few cases - SAS GPLOT

Hi,

I'm plotting a gplot in SAS 9.3, I'm not sure what mistake am I doing that it is not plotting lines on all the cases of my graph. the line is plotting for only one case.

Please refer to the attached graph.

Please help me to resolve this.

Naresh


Gplot.PNG

Accepted Solutions
Solution
‎10-27-2014 02:15 PM
SAS Employee
Posts: 977

Re: Missing Line on the Dots for few cases - SAS GPLOT

In that case, the easiest way is to leave the color= off the symbol statement, and let it take colors from the ods style that is in use. Something like this:

goptions reset=symbol;

symbol1 value=dot interpol=join repeat=3;

proc gplot data=sashelp.stocks;

plot close*date=stock;

run;

If you want to control the color of each line, you'll need a symbol statement for each line, such as ...

goptions reset=symbol;

symbol1 value=dot interpol=join color=red repeat=1;

symbol2 value=dot interpol=join color=pink repeat=1;

symbol3 value=dot interpol=join color=purple repeat=1;

proc gplot data=sashelp.stocks;

plot close*date=stock;

run;

View solution in original post


All Replies
Super User
Posts: 11,101

Re: Missing Line on the Dots for few cases - SAS GPLOT

Looks like you need additional SYMBOL statements with the I=Join option. This will also let you define more interesting markers.

You need one symbol statement for each response category to customize appearance.

Contributor
Posts: 40

Re: Missing Line on the Dots for few cases - SAS GPLOT

Hi,

What do you mean by additional symbol options. Could you please provide me some details.

here is my code.

I've already used symbol option with join.

*PLOTTING*/

symbol1 interpol=join value=dot;

AXIS1 LABEL = NONE ORDER = &cutoffweek. TO &lastfullweek.;

PROC GPLOT DATA = PCT_OSBYTIME&clientname.;

  TITLE "OS Usage Overtime - &clientname.";

  PLOT PCT_USAGE * WEEK = OS  / haxis= AXIS1 ;

/* PLOT PCT_USAGE * WEEK = OS;*/

RUN;

PROC GPLOT DATA = PCT_BROWSERBYTIME&clientname.;

  TITLE "Browser Usage Overtime - &clientname.";

  PLOT PCT_USAGE * WEEK = BROWSER  / haxis= AXIS1;

/* PLOT PCT_USAGE * WEEK = BROWSER;*/

RUN;

/* Define symbol characteristics */                                                                                                   

symbol1 color=vibg interpol=join value=dot;

PROC GPLOT DATA = PCT_RESLNBYTIME&clientname.;

  TITLE "Screen size usage Overtime - &clientname.";

  PLOT PCT_USAGE * WEEK = WIDTHBIN  / haxis= AXIS1;

/* PLOT PCT_USAGE * WEEK = WIDTHBIN ;*/

RUN;

SAS Employee
Posts: 977

Re: Missing Line on the Dots for few cases - SAS GPLOT

It could depend on how your data is structured - are you using "plot y*x=browser" or do you have a separate y-variable for each browser (which you 'overlay')? And it might also depend on whether you're using a traditional device such as png, or activex (or java).

Anyway, here's an example that shows one way to create a plot like what it appears you're wanting:

http://www.robslink.com/SAS/democd59/browser_wars.htm

http://www.robslink.com/SAS/democd59/browser_wars_info.htm

browser_wars.png

Contributor
Posts: 40

Re: Missing Line on the Dots for few cases - SAS GPLOT

Hi,

I don't have separate y variable for each category. I've single PCT variable for all the categories.

Please refer to the attached image.

plot1.PNG

Solution
‎10-27-2014 02:15 PM
SAS Employee
Posts: 977

Re: Missing Line on the Dots for few cases - SAS GPLOT

In that case, the easiest way is to leave the color= off the symbol statement, and let it take colors from the ods style that is in use. Something like this:

goptions reset=symbol;

symbol1 value=dot interpol=join repeat=3;

proc gplot data=sashelp.stocks;

plot close*date=stock;

run;

If you want to control the color of each line, you'll need a symbol statement for each line, such as ...

goptions reset=symbol;

symbol1 value=dot interpol=join color=red repeat=1;

symbol2 value=dot interpol=join color=pink repeat=1;

symbol3 value=dot interpol=join color=purple repeat=1;

proc gplot data=sashelp.stocks;

plot close*date=stock;

run;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 481 views
  • 0 likes
  • 3 in conversation