turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- getting values on a gplot

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

3 weeks ago

Hi,

How can I get values (n sample size) on a gplot for each timepoint?

Below is my code:

goptions reset = all ;

axis1 order =(1 to 4 by 1) label= (a=90 'Year') minor=none;

axis2 order = (4.5 to 4.6 by 0.01) label = ('Natural Log of lsmeans MSE Scores') minor=none ;

symbol1 interpol=std2mjt v=none color=blue r=1 w=2 v=plus;

symbol2 interpol=std2mjt v=none color=red r=1 w=2;

proc gplot data=means1;

plot estimate*year=cd / haxis = axis1 vaxis=axis2; where cd~=.;

run;

quit;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

3 weeks ago

the symbol statement for the would use the POINTLabel = option with "#varname": Pointlabel=("#sales") would label the displayed point with the value of the variable SAles associeated with that point.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Thank you ballardw.

I tried the code below and it didn't work. any idea why?

goptions reset = all ;

axis1 order =(1 to 4 by 1) label= (a=0 'Year') minor=none;

axis2 order = (4.5 to 4.6 by 0.01) label = (a=95 'Mean Scores') minor=none ;

symbol1 interpol=std2mjt v=none color=blue r=1;

symbol2 interpol=std2mjt v=none color=red r=1;**symbol3 v=dot cv=black pointlabel=("#ratio" c=black position=top);**

proc gplot data=data;

plot logscores*year=ratio/ haxis = axis1 vaxis=axis2; where ratio~=.;;

run;

quit;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

3 weeks ago

If you have the option to use SGPLOT this is much easer use either a TEXT or MARKERCHAR statement.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

thank you Reeza.

Is there an example code for the sgplot?

Many thanks!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Hi Reeza,

Thanks for your help with this. However, I still have yet to figure out how to make the sample size for each time point appear on the plot.

I am using a longitudinal dataset over 4 years. The exposure is a binary variable measured at baseline and the outcome is continuous. sgplot didn't seem to work.

I am using the following code, but it doesn't seem to take:

goptions reset = all ;

axis1 order =(0 to 4 by 1) label= (a=0 'Year') minor=none;

axis2 order = (4.5 to 4.6 by 0.1) label = (a=95 'Mean Scores') minor=none ;

symbol1 interpol=std2mjt v=none color=blue r=1;

symbol2 interpol=std2mjt v=none color=red r=1;

symbol3 v=dot i=none pointlabel=(position=top j=l "#ratio");

proc gplot data=means1;

plot estimate*year=ratio;

run;

quit;

any ideas?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

That's nice. Post sample data so we can actually run your code please. Or use a representative data set from SASHELP.

Post the SGPLOT code that didn't appear to work. I don't have access to SAS GRAPH.

Note: I'll move this post to the graphics forum so someone with access and expertise in SAS/GRAPH can help you if that's what you're choosing to use. SG Procedures produce better quality graphs, just as an FYI.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Hi Reeza,

thanks for your response.

I think I need to generate the sample size n similar to when I generate the lsmeans with the output statement when running the proc mixed...See example code below. any idea how to generate sample size n by group with the lsmeans ods output? I can then run the sgplot...I put in bold the code for the sample size with the sgplot...

Generating LSMeans proc mixed...

ods output LSMeans=means1;

proc mixed data=data NOCLPRINT;

class ID ratio yeareye;

model score = ratio year ratio*year;

repeated year/ subject=id type=cs;

lsmeans ratio*year;

run;

Then the sgplot:

proc sgplot data=means1;

series x=year y=estimate/ group=ratio;**xaxistable n/ class=ratio location=outside colorgroup=ratio valueattrs=(weight=bold ****size=10) labelattrs=(weight=bold size=10) title='Sample size at each visit' ****titleattrs=(weight=bold size=10);**

run;

Thanks,

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

I was actually able to solve it by generating the sample size using proc means and then merging with the lsmeans generated from proc mixed and using sgplot...

But if there is any way sample sizes at each time point can be generated using proc mixed, I would appreciate knowing that for you future reference.

thanks,.