<?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: Smoothed BAND? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Smoothed-BAND/m-p/967417#M376359</link>
    <description>&lt;P&gt;Wow, very nice! Had never heard of the msplint function - thank you!&lt;/P&gt;</description>
    <pubDate>Sun, 25 May 2025 11:32:18 GMT</pubDate>
    <dc:creator>quickbluefish</dc:creator>
    <dc:date>2025-05-25T11:32:18Z</dc:date>
    <item>
      <title>Smoothed BAND?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Smoothed-BAND/m-p/967400#M376352</link>
      <description>&lt;P&gt;Is there any way to get the band generated by the BAND statement to *smoothly* follow the line generated by SERIES when the SERIES statement is making use of the SMOOTHCONNECT option?&amp;nbsp; I have tried referencing the named line with the 'modelname' option in the BAND statement, but it seems to ignore that -- i.e., the band is still jagged while the line is smooth.&amp;nbsp; I realize that if I knew what algorithm was used by SMOOTHCONNECT, I could probably generate the upper and lower limits of the band manually, but I'm wondering if there's a simpler way?&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The below code generates some test data and illustrates the issue.&amp;nbsp; Thanks for any help!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
call streaminit(123456);
y=0;
pop=5000;
do x=1 to 50;
	y+rand('normal')*10;
	sd=500+rand('uniform')*250;
	l95=y-sd/sqrt(pop);
	u95=y+sd/sqrt(pop);
	output;
	pop+(-rand('integer',15,35));
end;
run;

proc sgplot data=test noautolegend;
series x=x y=y / smoothconnect name="line" lineattrs=(color=black thickness=2);
band x=x lower=l95 upper=u95 / modelname="line"
	fillattrs=(color=red) transparency=0.6;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="quickbluefish_0-1748091018136.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107323i36BD3A72FC34366C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="quickbluefish_0-1748091018136.png" alt="quickbluefish_0-1748091018136.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 May 2025 12:51:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Smoothed-BAND/m-p/967400#M376352</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-05-24T12:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Smoothed BAND?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Smoothed-BAND/m-p/967401#M376353</link>
      <description>Realize I forgot the '1.96' multiplier in generating the CIs, but same idea.</description>
      <pubDate>Sat, 24 May 2025 12:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Smoothed-BAND/m-p/967401#M376353</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-05-24T12:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Smoothed BAND?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Smoothed-BAND/m-p/967412#M376357</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
call streaminit(123456);
y=0;
pop=5000;
do x=1 to 50;
	y+rand('normal')*10;
	sd=500+rand('uniform')*250;
	l95=y-sd/sqrt(pop);
	u95=y+sd/sqrt(pop);
	output;
	pop+(-rand('integer',15,35));
end;
run;



proc sql noprint;
select count(*) into :nobs from test;
select min(x),max(x) into :x_min, :x_max from test;
select x into :x separated by ',' from test;
select y into :mean separated by ',' from test;
select l95 into :l95 separated by ',' from test;
select u95 into :u95 separated by ',' from test;
quit;

data msplint;
do x=&amp;amp;x_min. to &amp;amp;x_max. by 0.1;
spline_mean=msplint(x, &amp;amp;nobs.,&amp;amp;x., &amp;amp;mean.);
spline_l95=msplint(x, &amp;amp;nobs.,&amp;amp;x., &amp;amp;l95.);
spline_u95=msplint(x, &amp;amp;nobs.,&amp;amp;x., &amp;amp;u95.);
output;
end;
run;


proc sgplot data=msplint noautolegend;
band x=x lower=spline_l95 upper=spline_u95/fillattrs=(color=red) transparency=0.6;
series x=x y=spline_mean / smoothconnect lineattrs=(color=black thickness=2);
run;


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1748141028657.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107326i70224C41ECC0738F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1748141028657.png" alt="Ksharp_0-1748141028657.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 May 2025 02:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Smoothed-BAND/m-p/967412#M376357</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-05-25T02:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Smoothed BAND?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Smoothed-BAND/m-p/967417#M376359</link>
      <description>&lt;P&gt;Wow, very nice! Had never heard of the msplint function - thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 25 May 2025 11:32:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Smoothed-BAND/m-p/967417#M376359</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-05-25T11:32:18Z</dc:date>
    </item>
  </channel>
</rss>

