<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: proc SGPLOT: Overlay of Individual and Mean Plasma Concentrations in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/proc-SGPLOT-Overlay-of-Individual-and-Mean-Plasma-Concentrations/m-p/650625#M19954</link>
    <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19203"&gt;@sas_user&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please supply some sample data in DATALINES ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
    <pubDate>Tue, 26 May 2020 07:57:35 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2020-05-26T07:57:35Z</dc:date>
    <item>
      <title>proc SGPLOT: Overlay of Individual and Mean Plasma Concentrations</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-SGPLOT-Overlay-of-Individual-and-Mean-Plasma-Concentrations/m-p/650624#M19953</link>
      <description>&lt;P&gt;I am using Proc SGPLOT to develop a Graph that represents Overlay of Individual and Mean Plasma Concentrations. X axis has ATPT variable for time point. On Y axis i have AVAL variable to present Individual Concentrations and a MEAN variable containing mean of all concentrations. Requirement is to plot both Individual and Mean Plasma Concentrations on single graph. There are 3 treatments, so i am expecting 3 pages for 3 treatments with each page presenting Overlay of Individual and Mean Plasma Concentrations.&amp;nbsp;&lt;BR /&gt;I am using 2 series statement each for AVAL and Mean. The problem lies with sorting i think, for Individual Concentrations (AVAL) sorting needs to be done first by subjid and then ATPT to get spaghetti plot, but this sorting doesn't work with Mean plot as it needs to be sorted via time point first . Please see attached file to see Mock and actual Graph.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am using below code :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;proc sort data = pc2;
    by trtan trta subjid atptn atpt;
run;


proc sgplot data = pc2 dattrmap = anno pad = (bottom = 20%) NOAUTOLEGEND ;

    by trtan trta;

    series x = atptn y = aval/ group = trta  
        lineattrs = (color = black thickness = 1 pattern = solid );

    series x = atptn y = mean/ group = trta attrid = trtcolor  
        lineattrs = (thickness = 2 pattern = solid );


    xaxis label= "Actual Time (h)"
          labelattrs = (size = 10)
          values = (0 12 24 36 48 72 96 120 168)
          valueattrs = (size = 10)
          grid;

    yaxis label= "Plasma Concentration (ng/mL)"
          labelattrs = (size = 10)
          valueattrs = (size = 10)
          grid;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 May 2020 07:51:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-SGPLOT-Overlay-of-Individual-and-Mean-Plasma-Concentrations/m-p/650624#M19953</guid>
      <dc:creator>sas_user</dc:creator>
      <dc:date>2020-05-26T07:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc SGPLOT: Overlay of Individual and Mean Plasma Concentrations</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-SGPLOT-Overlay-of-Individual-and-Mean-Plasma-Concentrations/m-p/650625#M19954</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19203"&gt;@sas_user&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please supply some sample data in DATALINES ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 07:57:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-SGPLOT-Overlay-of-Individual-and-Mean-Plasma-Concentrations/m-p/650625#M19954</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-26T07:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: proc SGPLOT: Overlay of Individual and Mean Plasma Concentrations</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-SGPLOT-Overlay-of-Individual-and-Mean-Plasma-Concentrations/m-p/650641#M19955</link>
      <description>data dummy;&lt;BR /&gt;infile datalines delimiter = ',' missover;&lt;BR /&gt;input subject treatment $ trtnum aval atpt $ atptn mean;&lt;BR /&gt;&lt;BR /&gt;datalines;&lt;BR /&gt;&lt;BR /&gt;101,Trt1,1,55.75,0.5 hours,0.5,500.06694121&lt;BR /&gt;101,Trt1,1,2655.7,0.5 hours,0.5,500.06694121&lt;BR /&gt;101,Trt1,1,4.7635874439,0.5 hours,0.5,500.06694121&lt;BR /&gt;101,Trt1,1,67.51,1 hours,1,1393.5436913&lt;BR /&gt;101,Trt1,1,3364.56,1 hours,1,1393.5436913&lt;BR /&gt;101,Trt1,1,4.9837949933,1 hours,1,1393.5436913&lt;BR /&gt;101,Trt1,1,71.7,2 hours,2,1306.3579924&lt;BR /&gt;101,Trt1,1,3006.92,2 hours,2,1306.3579924&lt;BR /&gt;101,Trt1,1,4.1937517434,2 hours,2,1306.3579924&lt;BR /&gt;101,Trt1,1,96.42,4 hours,4,1157.3195013&lt;BR /&gt;101,Trt1,1,3088.92,4 hours,4,1157.3195013&lt;BR /&gt;101,Trt1,1,3.2036092097,4 hours,4,1157.3195013&lt;BR /&gt;101,Trt1,1,59.24,6 hours,6,1102.2535578&lt;BR /&gt;101,Trt1,1,2339.75,6 hours,6,1102.2535578&lt;BR /&gt;101,Trt1,1,3.9496117488,6 hours,6,1102.2535578&lt;BR /&gt;102,Trt1,1,45.75,0.5 hours,0.5,456.06694121&lt;BR /&gt;102,Trt1,1,4567.7,0.5 hours,0.5,456.06694121&lt;BR /&gt;102,Trt1,1,8.7635874439,0.5 hours,0.5,456.06694121&lt;BR /&gt;102,Trt1,1,23.51,1 hours,1,1567.5436913&lt;BR /&gt;102,Trt1,1,1234.56,1 hours,1,1567.5436913&lt;BR /&gt;102,Trt1,1,4.9837949933,1 hours,1,1567.5436913&lt;BR /&gt;102,Trt1,1,45.7,2 hours,2,1000.3579924&lt;BR /&gt;102,Trt1,1,3456.92,2 hours,2,1000.3579924&lt;BR /&gt;102,Trt1,1,8.1937517434,2 hours,2,1000.3579924&lt;BR /&gt;102,Trt1,1,34.42,4 hours,4,1157.3195013&lt;BR /&gt;102,Trt1,1,8907.92,4 hours,4,1157.3195013&lt;BR /&gt;102,Trt1,1,56.2036092097,4 hours,4,1157.3195013&lt;BR /&gt;102,Trt1,1,12.24,6 hours,6,1201.2535578&lt;BR /&gt;102,Trt1,1,123.75,6 hours,6,1201.2535578&lt;BR /&gt;102,Trt1,1,1.9496117488,6 hours,6,1201.2535578&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope it helps.</description>
      <pubDate>Tue, 26 May 2020 09:20:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-SGPLOT-Overlay-of-Individual-and-Mean-Plasma-Concentrations/m-p/650641#M19955</guid>
      <dc:creator>sas_user</dc:creator>
      <dc:date>2020-05-26T09:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc SGPLOT: Overlay of Individual and Mean Plasma Concentrations</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-SGPLOT-Overlay-of-Individual-and-Mean-Plasma-Concentrations/m-p/650648#M19956</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19203"&gt;@sas_user&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just a question:&lt;/P&gt;
&lt;P&gt;in your sample date, the mean variable does not correspond to the mean of aval for a subjid in a specific treatment group (trtan) at a specific time point (atptn). Is it normal? How is the 'mean' calculated?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is a mistake maybe you could try the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table pc3 as
	select a.*, b.mean_atpt_overall
	from 
		(select *, mean(aval) as mean_atpt_usbjid
		from pc2
		group by trtan, atpt ,subjid) as a
		inner join
		(select *, mean(aval) as mean_atpt_overall
		from pc2
		group by trtan, atpt) as b
	on a.subjid=b.subjid and a.aval=b.aval and a.atptn=b.atptn and a.trta=b.trta
	order by trtan, atptn, subjid;
run;

%macro plot (trtan);
	proc sgplot data = pc3 /*dattrmap = anno*/ pad = (bottom = 20%) NOAUTOLEGEND ;
		
		where trtan=&amp;amp;trtan.;
	
	    series x = atptn y = mean_atpt_usbjid / group=subjid
	        lineattrs = (color = black thickness = 1 pattern = solid);
	
	    series x = atptn y = mean_atpt_overall / attrid=trtcolor  
	        lineattrs = (thickness = 2 pattern = solid);
	
		title "Treatment = &amp;amp;trtan."; /*To be adapted*/
	   xaxis label= "Actual Time (h)"
	          labelattrs = (size = 10)
	         values = (0 12 24 36 48 72 96 120 168)
	          valueattrs = (size = 10)
	          grid;
	
	   yaxis label= "Plasma Concentration (ng/mL)"
	          labelattrs = (size = 10)
	          valueattrs = (size = 10)
	          grid;
	
	run;
%mend;

%plot (1)
%plot (2)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 10:15:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-SGPLOT-Overlay-of-Individual-and-Mean-Plasma-Concentrations/m-p/650648#M19956</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-26T10:15:13Z</dc:date>
    </item>
  </channel>
</rss>

