BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Ameurgen
Obsidian | Level 7

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
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
/*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;

Ksharp_0-1690285825170.png

 

View solution in original post

11 REPLIES 11
Reeza
Super User
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)

Ameurgen
Obsidian | Level 7

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

Reeza
Super User
Not a MR.
Remove the BY statement from the SGPLOT code to have all the plots combined. The graphic will be illegible.
Ameurgen
Obsidian | Level 7
sorry , thank you so much
Ameurgen
Obsidian | Level 7

In fact, i need that all  these generated  individual graphs being fit into the same big graph like these images below.

thank you.

Ameurgen_0-1690229896002.png

Ameurgen_1-1690230043530.png

 

ballardw
Super User

@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.

Ameurgen_0-1690229896002.png

Ameurgen_1-1690230043530.png

 


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.

Reeza
Super User
Ok. So what is your X axis, Y Axis and Panel (Microsoft, Intel, IBM) as in the example?
Ksharp
Super User
/*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;

Ksharp_0-1690285825170.png

 

Ameurgen
Obsidian | Level 7
thank you so much
Ameurgen
Obsidian | Level 7

hi again, 

i need to icrease the size of this panel, can any option i should use it?

Thank you again

ballardw
Super User

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


 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 11 replies
  • 676 views
  • 4 likes
  • 4 in conversation