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
- /
- Base SAS Programming
- /
- SAS 9.4 Code help

Topic Options

- 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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-17-2018 12:11 AM

Greeting All

I need hand with SAS 9.4 code, which is related to annotate letters above each midpoint bar of confidence interval .In order to know change in weight loss between the three groups overtime (day)

Best Regards

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

Posted in reply to samer_badri75_gmail_com

01-17-2018 12:23 AM

Hi:

Many people don't like to open Excel files. What does your data look like and what program code have you tried? How are you creating your output? How to do what you want will depend on the code you have started with.

cynthia

Many people don't like to open Excel files. What does your data look like and what program code have you tried? How are you creating your output? How to do what you want will depend on the code you have started with.

cynthia

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

Posted in reply to Cynthia_sas

01-17-2018 12:30 AM

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

Posted in reply to samer_badri75_gmail_com

01-17-2018 01:12 AM

I'm not sure exactly what you are trying to do, but search the Graphically Speaking Blog. Tons of examples of all thinkable graphs and code examples

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

Posted in reply to draycut

01-17-2018 11:40 AM

Thanks for your help. I can't found what I need their.

I am trying to get error bars with letters to show the differences

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

Posted in reply to samer_badri75_gmail_com

01-17-2018 01:35 PM - edited 01-17-2018 01:55 PM

Hi: You might also consider posting this in the ODS Graphics forum, where most of the graph related questions are posted and answered.

Cynthia

Also, in looking at the code you posted in the program 1.sas, I see that you have 2 PROC GPLOT steps and you have those 2 steps followed by a PROC GLM and a PROC MIXED. It does not appear that you have ODS GRAPHICS turned on for PROC GLM or PROC MIXED, although both of those procedures do work with ODS GRAPHICS and you can see examples of the kind of graphs they generate here: http://go.documentation.sas.com/?docsetId=statug&docsetVersion=14.3&docsetTarget=statug_glm_details7... for GLM and here: http://go.documentation.sas.com/?docsetId=statug&docsetVersion=14.3&docsetTarget=statug_mixed_detail... for MIXED. Scroll down to the bottom of the explanation and look for the table that says Graphs Produced by PROC xxx.

To change the GPLOT code, you would need to look at the ANNOTATE facility. If you switch to the SGPLOT procedure instead of GPLOT or use the ODS GRAPHICS capability within the Statistical procedures, you may be able to get closer to what you want with the graph.

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

Posted in reply to Cynthia_sas

01-17-2018 05:19 PM

Many thanks

I will try my best to do that but I am not sure if I can or not.

Thanks for help

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

Posted in reply to samer_badri75_gmail_com

01-17-2018 04:46 PM

you need to give some details on how the chars to be shown over each bar are created

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

Posted in reply to Bruno_SAS

01-17-2018 05:17 PM

I upload Doc file with two pictures the color one under name data I my work and I want to show the later like the other picture on the bars.

Best Regards

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

Posted in reply to samer_badri75_gmail_com

01-17-2018 05:39 PM

Hi:

You have posted those pictures and posted some code. But you do NOT explain how you have created the text strings of A, B, BC, and C that you show above the bars.

Cynthia

You have posted those pictures and posted some code. But you do NOT explain how you have created the text strings of A, B, BC, and C that you show above the bars.

Cynthia

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

Posted in reply to Cynthia_sas

01-17-2018 05:42 PM

Greeting All

The pic for A,B, bc, bc, c Not for me I need my work to be similar to that picture

Thanks

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

Posted in reply to samer_badri75_gmail_com

01-17-2018 07:55 PM - edited 01-17-2018 07:56 PM

Hi:

I still don't understand what you want. Your first GPLOT, when you add the PROC SORT step, produces this output:

Your second GPLOT step produces this output:

Your GLM step and your MIXED steps are NOT producing any graphical output right now, only tabular results from the procedure.

I do not see anything in your code that calculates a "difference" variable that could be annotated. I do not know what values you would use to calculate the difference variable that you want to see. I don't even know whether the graphs you're producing with GPLOT even look like the graphs you want to create because you sent two different graphs in your original post and neither of those graphs look like what you are producing now.

Here's one chart:

and here's the other:

I wonder if perhaps you are looking for something more similar to this example: https://blogs.sas.com/content/graphicallyspeaking/2011/11/12/graphs-with-axis-aligned-statistics-tab...

cynthia

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

Posted in reply to Cynthia_sas

01-20-2018 04:39 PM

* WP; title2"WP"; data WP; input Treatment$ Rep Day1 Day2 Day3 Day4 Day5 Day6 Day7 Day8 Day9 Day10; datalines; Ec 1.00 0.00 0.25 0.52 0.77 0.89 0.89 1.02 1.02 1.02 1.15 Ec 2.00 0.00 0.51 0.92 1.13 1.23 1.23 1.43 1.44 1.53 1.53 Ec 3.00 0.00 0.33 0.44 0.44 0.66 0.88 0.88 1.32 1.65 2.74 Ec 4.00 0.00 0.99 1.58 2.67 3.36 4.73 5.33 9.08 9.27 9.57 FB 1.00 0.00 0.59 0.69 1.75 1.98 1.98 2.23 2.67 2.78 2.90 FB 2.00 0.00 0.79 1.24 1.24 1.45 1.80 1.93 2.29 2.73 2.96 FB 3.00 0.00 0.42 0.72 1.34 1.75 2.26 2.57 2.78 2.88 5.14 FB 4.00 0.00 2.05 3.49 4.64 6.16 7.04 7.52 12.88 15.68 15.68 RES 1.00 0.00 1.34 1.47 1.83 2.07 2.19 2.58 2.95 3.31 3.31 RES 2.00 0.00 0.68 0.79 1.24 1.47 1.47 1.57 2.05 2.37 2.60 RES 3.00 0.00 0.76 1.31 1.85 2.18 2.18 2.40 2.94 3.48 4.68 RES 4.00 0.00 3.42 5.07 6.73 7.71 9.47 10.35 14.85 17.10 17.10 ; run; * Convert columns of observations to rows - useful for plotting; data WPplot; set WP; keep treatment rep Day WP; Day=1; WP=Day1; output; Day=2; WP=Day2; output; Day=3; WP=Day3; output; Day=4; WP=Day4; output; Day=5; WP=Day5; output; Day=6; WP=Day6; output; Day=7; WP=Day7; output; Day=8; WP=Day8; output; Day=9; WP=Day9; output; Day=10; WP=Day10; output; run; * Print column data set; proc print data=WPplot; run; * Plot observations for each subject through Day; proc gplot data=WPplot uniform; by treatment; plot WP*Day=rep; symbol1 i=j; run; * Plot means for each treatment through Day; proc gplot data=WPplot; plot WP*Day=treatment; symbol1 i=std1mjt; run; * Profile analysis and repeated measures ANOVA; proc glm data=WP; class treatment; model Day1 Day2 Day3 Day4 Day5 Day6 Day7 Day8 Day9 Day10= treatment / nouni; repeated Day profile; run; * Mixed models analysis; proc mixed data=WPplot; class treatment Day rep; model WP = treatment Day treatment*Day / outp=resids; * Try type=cs, type=ar(1), or type=un and compare AIC or BIC values. The model with smallest AIC or BIC is the best model; repeated / type=cs subject=rep(treatment) rcorr; run; quit; proc sgplot data=resids; vbarparm category=day response=pred /group=treatment groupdisplay=cluster limitlower=lower limitupper=upper ; run; proc means data=sashelp.cars noprint nway; where origin='USA'; class make cylinders; var mpg_city; output out=have (where=(lclm ne . )) mean=vag lclm=lclm uclm=uclm; run; *creat graph; ods html style=meadow; vbarparm category=make response=avg / /*set x axis and response variables*/ group=cylinders /*specify how to group the variables*/ groupdisplay=cluster /*make sure bars aren't stacked*/ limitlower=lclm /*error bar lower limit*/ limitupper=uclm /*error bar upper limit*/; run;

Many thanks for your explanation, actually what I am looking for, I need the letter that show the differences on the bars.

I am try to run this program, but there is some thing wrongs. The code I add did not work.

I saw the example it look difference

Best Regards

Samir

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

Posted in reply to samer_badri75_gmail_com

01-21-2018 09:46 AM

Hi:

In your original code, you have 3 datasets: WP, WPPlot and Resids. Let's start with these questions:

1) which of these datasets has the "difference" variable you want to plot

2) what is the name of the "difference" variable

No one can help you with your question until you provide ALL the data. saying you want the "difference" is meaningless, since at the present time, there does NOT seem to be a difference variable in any of the 3 datasets in your code.

As for why your added code did not work, I suggest you carefully compare what you copied in with the original suggested code that was supplied by Reeza here: https://communities.sas.com/t5/SAS-GRAPH-and-ODS-Graphics/Graphic-help/m-p/428640#M14819 -- in a quick comparison, I note that her post had a PROC SGPLOT statement and your pasted code is missing that statement.

cynthia

In your original code, you have 3 datasets: WP, WPPlot and Resids. Let's start with these questions:

1) which of these datasets has the "difference" variable you want to plot

2) what is the name of the "difference" variable

No one can help you with your question until you provide ALL the data. saying you want the "difference" is meaningless, since at the present time, there does NOT seem to be a difference variable in any of the 3 datasets in your code.

As for why your added code did not work, I suggest you carefully compare what you copied in with the original suggested code that was supplied by Reeza here: https://communities.sas.com/t5/SAS-GRAPH-and-ODS-Graphics/Graphic-help/m-p/428640#M14819 -- in a quick comparison, I note that her post had a PROC SGPLOT statement and your pasted code is missing that statement.

cynthia

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

Posted in reply to Cynthia_sas

01-21-2018 03:36 PM

Hello

My treatment is EC, FB, and RES and my y axis is WP which is weight loss and my x axis is the day.

I want to know the difference between the day in each treatment.

I know for this data it was no sig but I have more data.

Thanks

Samir