04-10-2015 11:26 AM
I am a user new to sas as well as this forum. I am trying to create scatterplots in sas using PROC SGSCATTER to generate scatterplots (of groups male and female) of variable X against variables Y1, Y3, Y4, and Y5.
Following is my code:
ods listing gpath='C:\';
ods graphics / reset height=4.5in width=8.925in imagefmt=png imagename="img1";
proc sgscatter data=test;
plot Y1*X Y3*X Y4*X Y5*X /group=gender rows=2 columns=3 ;
ods listing close;
The above produces an image file with 3 plots in the first row and 1 plot in the second row. However, I am having difficulty in drawing a straight line passing through the origin in each of the 4 plots.Is there any way I can extend this code so that a straight line passing through the origin appears in each of my plots? I tried using the sganno option that included a 'line' function, but it does nto seem to help. I would appreciate any useful input. Thanks.
This is how my image looks:
04-10-2015 11:53 AM
Thanks for your response. I am getting this warning message.
WARNING: X=PBSPLINE_X_Y5_GROUP_SORT_G__X is invalid. The option expects at least one non-missing value in the column.
However, this results in each plot with 2 different line for each gender group. I was just trying to insert a single line that that connects the points, say, (0,0) to (100,100) in each of the plots.
04-10-2015 12:52 PM
I used this:
x1=0; y1=0; x2=100; y2=100;
I used the above dataset with the sganno option.
this creates a 45 degree line across the entire page, not the individual plots.