Hi every one,
I need someone who hlep me to plot this interaction effect, 'Dam_DIM*BHB_level', in fact. i need to plot each estimate /stderr for each class of dam dim (data tye below) separtely but i need them in same graph .
Thank you so much
AEK
| Effect | Dam_DIM | BHB_level | Estimate | StdErr | 
| Dam_DIM*BHB_level | 40 | 1 | 2.043749 | 0.322013 | 
| Dam_DIM*BHB_level | 40 | 2 | 3.901488 | 1.087312 | 
| Dam_DIM*BHB_level | 40 | 3 | 1.062172 | 1.54232 | 
| Dam_DIM*BHB_level | 41 | 1 | 2.249216 | 0.235116 | 
| Dam_DIM*BHB_level | 41 | 2 | 0.565903 | 1.090099 | 
| Dam_DIM*BHB_level | 41 | 3 | 2.701593 | 1.090606 | 
| Dam_DIM*BHB_level | 42 | 1 | 1.792403 | 0.245552 | 
| Dam_DIM*BHB_level | 42 | 2 | 1.112829 | 0.768846 | 
| Dam_DIM*BHB_level | 42 | 3 | 1.688574 | 0.888367 | 
| Dam_DIM*BHB_level | 43 | 1 | 2.376633 | 0.219771 | 
| Dam_DIM*BHB_level | 43 | 2 | 1.27013 | 0.891122 | 
| Dam_DIM*BHB_level | 43 | 3 | 1.916425 | 0.890338 | 
| Dam_DIM*BHB_level | 44 | 1 | 2.132965 | 0.206136 | 
| Dam_DIM*BHB_level | 44 | 2 | 1.614088 | 0.689099 | 
| Dam_DIM*BHB_level | 44 | 3 | 1.699703 | 0.489219 | 
| Dam_DIM*BHB_level | 45 | 1 | 2.212038 | 0.164627 | 
| Dam_DIM*BHB_level | 45 | 2 | 1.929883 | 0.583418 | 
| Dam_DIM*BHB_level | 45 | 3 | 2.660124 | 0.895636 | 
| Dam_DIM*BHB_level | 46 | 1 | 2.270605 | 0.175451 | 
| Dam_DIM*BHB_level | 46 | 2 | 3.669002 | 0.691404 | 
| Dam_DIM*BHB_level | 46 | 3 | 1.535585 | 0.629573 | 
| Dam_DIM*BHB_level | 47 | 1 | 2.239754 | 0.151429 | 
| Dam_DIM*BHB_level | 47 | 2 | 1.451391 | 0.487349 | 
| Dam_DIM*BHB_level | 47 | 3 | 2.092391 | 0.773509 | 
| Dam_DIM*BHB_level | 48 | 1 | 1.895402 | 0.129621 | 
| Dam_DIM*BHB_level | 48 | 2 | 2.366137 | 0.487984 | 
| Dam_DIM*BHB_level | 48 | 3 | 2.436751 | 0.515205 | 
| Dam_DIM*BHB_level | 49 | 1 | 1.965602 | 0.118208 | 
| Dam_DIM*BHB_level | 49 | 2 | 2.073335 | 0.364214 | 
| Dam_DIM*BHB_level | 49 | 3 | 3.603161 | 0.633997 | 
| Dam_DIM*BHB_level | 50 | 1 | 1.971263 | 0.107649 | 
| Dam_DIM*BHB_level | 50 | 2 | 2.613094 | 0.488233 | 
| Dam_DIM*BHB_level | 50 | 3 | 1.947197 | 0.514633 | 
/*Using Reeza's dataset*/
proc sgpanel data=have noautolegend;
panelby dam_dim/layout=rowlattice novarname onepanel  ;
series x=bhb_level y=estimate/group=dam_dim;
scatter x=bhb_level y=estimate/group=dam_dim yerrorlower=lower yerrorupper=upper;
run;
data have;
infile cards truncover;
informat effect $50.;
input Effect  Dam_DIM BHB_level   Estimate    StdErr;
upper = estimate+stderr;
lower = estimate - stderr;
cards;
Dam_DIM*BHB_level   40  1   2.043749    0.322013
Dam_DIM*BHB_level   40  2   3.901488    1.087312
Dam_DIM*BHB_level   40  3   1.062172    1.54232
Dam_DIM*BHB_level   41  1   2.249216    0.235116
Dam_DIM*BHB_level   41  2   0.565903    1.090099
Dam_DIM*BHB_level   41  3   2.701593    1.090606
Dam_DIM*BHB_level   42  1   1.792403    0.245552
Dam_DIM*BHB_level   42  2   1.112829    0.768846
Dam_DIM*BHB_level   42  3   1.688574    0.888367
Dam_DIM*BHB_level   43  1   2.376633    0.219771
Dam_DIM*BHB_level   43  2   1.27013 0.891122
Dam_DIM*BHB_level   43  3   1.916425    0.890338
Dam_DIM*BHB_level   44  1   2.132965    0.206136
Dam_DIM*BHB_level   44  2   1.614088    0.689099
Dam_DIM*BHB_level   44  3   1.699703    0.489219
Dam_DIM*BHB_level   45  1   2.212038    0.164627
Dam_DIM*BHB_level   45  2   1.929883    0.583418
Dam_DIM*BHB_level   45  3   2.660124    0.895636
Dam_DIM*BHB_level   46  1   2.270605    0.175451
Dam_DIM*BHB_level   46  2   3.669002    0.691404
Dam_DIM*BHB_level   46  3   1.535585    0.629573
Dam_DIM*BHB_level   47  1   2.239754    0.151429
Dam_DIM*BHB_level   47  2   1.451391    0.487349
Dam_DIM*BHB_level   47  3   2.092391    0.773509
Dam_DIM*BHB_level   48  1   1.895402    0.129621
Dam_DIM*BHB_level   48  2   2.366137    0.487984
Dam_DIM*BHB_level   48  3   2.436751    0.515205
Dam_DIM*BHB_level   49  1   1.965602    0.118208
Dam_DIM*BHB_level   49  2   2.073335    0.364214
Dam_DIM*BHB_level   49  3   3.603161    0.633997
Dam_DIM*BHB_level   50  1   1.971263    0.107649
Dam_DIM*BHB_level   50  2   2.613094    0.488233
Dam_DIM*BHB_level   50  3   1.947197    0.514633
;
run;
proc sgplot data=have;
by dam_dim;
series x=bhb_level y=estimate/group=dam_dim;
scatter x=bhb_level y=estimate/group=dam_dim yerrorlower=lower yerrorupper=upper;
run;Remove the BY for a single graph....but it will be messy.
(Upper/Lower should be calculated, not sure I did that correctly here, but just demonstrating how it can be done)
Thank you for your quick response Mr Reeza,
Just i have another question , can we put all these individual graph into one , not overlapping them , but in the same panel .
Thank you again
In fact, i need that all these generated individual graphs being fit into the same big graph like these images below.
thank you.
@Ameurgen wrote:
In fact, i need that all these generated individual graphs being fit into the same big graph like these images below.
thank you.
Your top graph would work with a Group= variable assuming the values are distinct enough as shown.
The second graph would be Proc Sgpanel where you provide a variable on a Panelby statement to create one 'panel' of the graph per valued. Axis definitions come into play though.
/*Using Reeza's dataset*/
proc sgpanel data=have noautolegend;
panelby dam_dim/layout=rowlattice novarname onepanel  ;
series x=bhb_level y=estimate/group=dam_dim;
scatter x=bhb_level y=estimate/group=dam_dim yerrorlower=lower yerrorupper=upper;
run;
hi again,
i need to icrease the size of this panel, can any option i should use it?
Thank you again
The ODS GRAPHICS statement has options to set the height and width of the graph area.
Make sure to pick your unit, inches, mm, cm . Note that it is possible to create conflicts with destinations like RTF or PDF files where your graph is bigger than the virtual papersize and won't fit.
for example.
ods graphics / height= 10in width=8in;
This would have to be executed before the graph procedure.
@Ameurgen wrote:
hi again,
i need to icrease the size of this panel, can any option i should use it?
Thank you again
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.
