Data visualization with SAS programming

Regression,Median and scatter points in one plot using gplot

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Regression,Median and scatter points in one plot using gplot

Hi 

 

Below sample data 

visit     dosem   avalue

1          50         8.66

 2         50         6.33

1          100        6.88

2           100        8.33

1           200       76.22

2           200        65.22

1           400       55.88

2           400       88.77

1           50      77.22

2           50      54.3

3            50       54

4             50      45

5             50     0.003

6             50     .001

I am trying to generate a plot whi ch will have all avalues as scatter points by each visitn

like dose*avalue=visit

i want to represent median line in the plot

also i want a regression ln(dose) = ln(avalue)

                             then (intercept*x**slope) is equation

 

VISIT variable decode

I calculated median and regression estimates values kept in one dataset

1-single dose scatter plot

2-multiple dose scatter plot

3.median of single dose

4.median of multiple dose

5.regression value of single dose

6.multiple dose regrssion value

 

then I used below procedure

 

symbol1 color=black value=circle height=1.5 mode=include INTERPOL=none;
symbol2 color=grey value=trianglefilled height=1.5 mode=include INTERPOL=none;
symbol3 color=blue w = 3 height=2 mode=include INTERPOL=hiloct;
symbol4 color=green w = 3 height=2 mode=include INTERPOL=hiloct ;

/* Define the symbol characteristics for the regression line */
symbol5 interpol=rl value=none color=black;
*symbol5 interpol=join value=dot color=black l=1;
*symbol6 interpol=join value=circle color=black l=2;
symbol6 interpol=rl value=none color=grey l=2;

proc sort data = x1;
by avisitn dose ;
run;


proc gplot data = x1;
plot avalue * dose = avisitn/ vaxis=axis1 haxis=axis2 noframe nolegend;
run;
quit;

 

My question my regression line not coming staright and also

I want both x,y scales in log base and custom tick marks

 

The data i gave example so values may not look correct

appreciate help

 

thank u

 

 


Accepted Solutions
Solution
‎09-25-2017 09:34 PM
Contributor
Posts: 20

Re: Regression,Median and scatter points in one plot using gplot

Hi @valli

 

If you want to overlay scatter, median line and regression line on one plot. There are two options:

1. PROC GPLOT, use PLOT, PLOT2 statements and ANNOTATION for three tasks. ex. you can use ANNOTATION for scatter, PLOT for median line and PLOT2 for regression line with SYMBOL statement to define INTERPOL=R<type><0><CLM | CLI<50...99>>. (http://www.okstate.edu/sas/v8/sashtml/gref/zbolchap.htm)

2. SGPLOT or SGSCATTER depend on the output you want to display.

 

Hope it will help.

View solution in original post


All Replies
PROC Star
Posts: 1,759

Re: Regression,Median and scatter points in one plot using gplot

Please submit usable data:

Your variable names are inconsistent, axis1 and axis2 statements are not provided.

 

Regarding the regression, did you see this message that your code generates? :

WARNING: Fewer than three node values for at least one observation in HILOC interpolation. Mean value used for tick placement.

 

 

Solution
‎09-25-2017 09:34 PM
Contributor
Posts: 20

Re: Regression,Median and scatter points in one plot using gplot

Hi @valli

 

If you want to overlay scatter, median line and regression line on one plot. There are two options:

1. PROC GPLOT, use PLOT, PLOT2 statements and ANNOTATION for three tasks. ex. you can use ANNOTATION for scatter, PLOT for median line and PLOT2 for regression line with SYMBOL statement to define INTERPOL=R<type><0><CLM | CLI<50...99>>. (http://www.okstate.edu/sas/v8/sashtml/gref/zbolchap.htm)

2. SGPLOT or SGSCATTER depend on the output you want to display.

 

Hope it will help.

☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 290 views
  • 0 likes
  • 3 in conversation