```Date: Fri, 17 Mar 2006 18:17:44 -0500 Reply-To: Arthur Tabachneck Sender: "SAS(r) Discussion" From: Arthur Tabachneck Subject: Re: Diagram with MEAN Comments: To: SUBSCRIBE SAS-L Irin Ros Content-Type: text/plain; charset=ISO-8859-1 I responded to Irin with the following, off-line, admitting that I am definitely not well versed in SAS/GRAPH. Is there a better way to accomplish what Irin is trying to achieve? data b_1; input gapmonth difftotal; cards; 1 3 1 4 1 5 1 6 2 5 2 6 2 7 3 6 3 7 3 8 4 7 4 8 4 9 ; run; proc means data=b_1 mean nway; var difftotal; class gapmonth; output out=b_2 mean=; run; proc sql noprint; select mean(difftotal) into :average from b_1; quit; TITLE 'Line Chart difftotal by gapmonth'; symbol1 interpol=join value=dot height=1; proc gplot data=b_2; plot difftotal*gapmonth / haxis=1 to 4 by 1 vaxis=0 to 8 by 2 vref=&average.; run; quit; Art ---------- On Fri, 17 Mar 2006 11:59:07 -0800, Irin later wrote: >David, > > My URL is the following: > > http://www.geocities.com/irinaroscom > > This is my very first experience in html and paint software. So forgive me for an ugly sketch! > Horizontal X-axis represents a gap month between two survey (baseline and first survey) > Vertical Y-axis represents mean survey score difference. Below is how I calculated them: > data B_1; > merge studyFstFollowup (in=a) > studyBase(in=b); > by memberid; > if a=1 and b=1 ; > Gapmonth_B_F=monthFst-monthBase; > diffTotal= Sb - S1; * Sb-Baseline score while S1-1ST FOLLOWUP SCORE > run; > > proc means data=B_1 n mean std t prt; > var diffTotal; > title 'Is the Total Score on StudyFstfollowup higher than StudyBase'; > run; > ********************************************************** > Therefore my dataset b_1 contains 2 columns : DiffTotal and Gapmonth_B_f > > I need to create a DIAGRAM (chart) with the following axises: > >1.Mean of DiffTotal differences for each gap month >2.Gapmonth_b_f > >My question is: how to create a diagram so that axis Y show MEAN of Difftotal while axis X show gap month and in addition there would be a line parallel to horizontal x-axis which should represent MEAN for the entire population (while a thin line should represent Means for each gapmonth) ? > > Actually the code below which Art gave me illustrated how it goes too, but I need a diagram instead a histogram and in addition I need a single (parallel line of MEAN for entire population (which I do not know how to implement) > > PROC GCHART data=b_1 ; > VBAR gapmonth_b_f / SUMVAR=difftotal TYPE=MEAN; > TITLE 'Gapmonth_b_f between Baseline and First Followup surveys'/SUMVAR=difftotal TYPE=MEAN; > run; > quit; > > Thank you! > > Irin > > >David L Cassell wrote: irinfigvam@YAHOO.COM wrote back: >> Thank you very much , I got the result but it looks more like a >>histogram (vertical bars) while I am looking for a diagram/grahic?…which >>means one line from the top to the top of each vertical bar. Sorry for the >>confusion. I am not sure how to name it in English. >> While I need means for each gapmonth I also need another line (parrallel >>to the x_axis) on the graphic which shows one value of Mean for the entire >>population. >> >> Is there any way to do it as this kind of diagram? > >[1] Your English is great. Better than some people who are *supposed* >to write English clearly. Don't worry about your English. > >[2] You need to write back to the list and describe very carefully exactly >what you want your graph to look like. If you have a picture, you can >give the URL so we can look at the desired form. (Don't try to attach >anything. Attachments get removed at the listserv.) > >[3] If you don't want something like a histogram or a vertical bar chart, >then you need to give us the exact details on how your needs differ from >what the various SAS/GRAPH output give you. > >[4] A single line going across the chart is easy. There's a REF= option >that lets you draw a line at any Y value you want. You can even control >whether the line goes behind the bars (normal behavior) or goes in front >of the bars (option FRONTREF). But you have to tell us all your >requirements before we can tell oyu how to get them. > >HTH, >David >-- >David L. Cassell >mathematical statistician >Design Pathways >3115 NW Norwood Pl. >Corvallis OR 97330 > >_________________________________________________________________ >Don’t just search. Find. Check out the new MSN Search! >http://search.msn.click-url.com/go/onm00200636ave/direct/01/ > > > >--------------------------------- >Yahoo! Mail >Bring photos to life! New PhotoMail makes sharing a breeze. ```

Back to: Top of message | Previous page | Main SAS-L page