<?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: plot predicted values from modeled data with transformed variables in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/plot-predicted-values-from-modeled-data-with-transformed/m-p/919787#M45677</link>
    <description>yes that works! my issue is that i am trying to use splined terms, so i have new age variables, like age2, age3, age4 from proc transreg.... and i dont know how to incorporate those new terms.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 11 Mar 2024 16:15:34 GMT</pubDate>
    <dc:creator>pamplemousse822</dc:creator>
    <dc:date>2024-03-11T16:15:34Z</dc:date>
    <item>
      <title>plot predicted values from modeled data with transformed variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-predicted-values-from-modeled-data-with-transformed/m-p/919171#M45636</link>
      <description>&lt;P&gt;i want to plot outcome over time using predicted outcomes for an "average" observation from a model with transformed time variables (time^2). This works if I include the transformed variable in the model without calling in a new variable (e.g., time time*time). How can I make this work if i want to call in a new variable (vs. time time_sq, where time_sq=time*time)? Thanks!&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	*version 1: age age*age.... code works!;
	proc genmod data=dat; 
		class idno male edu; 
		model score= age|x age*age male edu_4; 
		repeated subject=idno; 
		weight w;
		store contcont; 
	run;

	data scoredata; *set covs to ref or mean; 
		male=0;
		edu=0;
		do x = 12, 18;
		do age = 70 to 100 by 1; 
			output; 
		end; end;
	run; 

	proc plm source=contcont; 
		 score data=scoredata out=plotdata predicted=pred lclm=lower uclm=upper; 
	run; 

	proc sgplot data=plotdata; 
		band x=age upper=upper lower=lower / group=x transparency=0.5; 
		series x=age y=pred / group=x; 
		yaxis label="score"; 
	run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Version 1 (age age*age in model)" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94421iE95F8AF5E23F35BA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture1.JPG" alt="Version 1 (age age*age in model)" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Version 1 (age age*age in model)&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*version 2 (age age_sq)...code doesn't work;
	data dat2; 
		set dat; 
		age_sq=age*age; 
	run; 

	proc genmod data=dat2; 
		class idno male edu; 
		model score= age|x age_sq male edu_4; 
		repeated subject=idno; 
		weight w;
		store contcont; 
	run;

	data scoredata; *set covs to ref or mean; 
		male=0;
		edu=0;
		age_sq=6783; *mean value.. i have also tried omitting this and proc plm won't run because it needs all the variables;
		do x = 12, 18;
		do age = 70 to 100 by 1; 

			output; 
		end; end;
	run; 

	proc plm source=contcont; 
		 score data=scoredata out=plotdata predicted=pred lclm=lower uclm=upper; 
	run; 

	proc sgplot data=plotdata; 
		band x=age upper=upper lower=lower / group=x transparency=0.5; 
		series x=age y=pred / group=x; 
		yaxis label="score"; 
	run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Version 2 (age age_sq in model)" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94423iE31EA8BFF3B774B0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture2.JPG" alt="Version 2 (age age_sq in model)" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Version 2 (age age_sq in model)&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 17:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-predicted-values-from-modeled-data-with-transformed/m-p/919171#M45636</guid>
      <dc:creator>pamplemousse822</dc:creator>
      <dc:date>2024-03-06T17:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: plot predicted values from modeled data with transformed variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-predicted-values-from-modeled-data-with-transformed/m-p/919458#M45652</link>
      <description>&lt;P&gt;Maybe I don't get it right ...&lt;/P&gt;
&lt;P&gt;but shouldn't you replace (in your second code block) this piece of code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data scoredata; *set covs to ref or mean; 
	male=0;
	edu=0;
	age_sq=6783; *mean value.. i have also tried omitting this and proc plm won't run because it needs all the variables;
	do x = 12, 18;
	do age = 70 to 100 by 1; 

		output; 
	end; end;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;with this piece of code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data scoredata; *set covs to ref or mean; 
	male=0;
	edu=0;
*age_sq=6783; *mean value.. i have also tried omitting this and proc plm won't run because it needs all the variables;
	do x = 12, 18;
	do age = 70 to 100 by 1; 
        age_sq = age*age;
		output; 
	end; end;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;??&lt;BR /&gt;&lt;BR /&gt;Koen&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 14:39:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-predicted-values-from-modeled-data-with-transformed/m-p/919458#M45652</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-03-08T14:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: plot predicted values from modeled data with transformed variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-predicted-values-from-modeled-data-with-transformed/m-p/919787#M45677</link>
      <description>yes that works! my issue is that i am trying to use splined terms, so i have new age variables, like age2, age3, age4 from proc transreg.... and i dont know how to incorporate those new terms.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Mar 2024 16:15:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-predicted-values-from-modeled-data-with-transformed/m-p/919787#M45677</guid>
      <dc:creator>pamplemousse822</dc:creator>
      <dc:date>2024-03-11T16:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: plot predicted values from modeled data with transformed variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-predicted-values-from-modeled-data-with-transformed/m-p/919792#M45678</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/54903"&gt;@pamplemousse822&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;yes that works! my issue is that i am trying to use splined terms, so i have new age variables, like age2, age3, age4 from proc transreg.... and i dont know how to incorporate those new terms.&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't think Proc PLM will allow you to use variables that weren't in the original model.&lt;/P&gt;
&lt;P&gt;You may be skipping out&amp;nbsp; on a clear description of what you are attempting. Perhaps you want to rename Age2 as Age and run PLM to create set with that variable as the age? Then rename Age3 ?&lt;/P&gt;
&lt;P&gt;You should be able to do that as a data set option on the SCORE statement.&lt;/P&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;score data=yourdataset (rename=(age2=age)) out=age2_scored_set /*other score options*/ ;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 16:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-predicted-values-from-modeled-data-with-transformed/m-p/919792#M45678</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-11T16:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: plot predicted values from modeled data with transformed variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-predicted-values-from-modeled-data-with-transformed/m-p/919793#M45679</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/54903"&gt;@pamplemousse822&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;yes that works! my issue is that i am trying to use splined terms, so i have new age variables, like age2, age3, age4 from proc transreg.... and i dont know how to incorporate those new terms.&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There's no need to use PROC TRANSREG to construct your splined terms.&lt;BR /&gt;&lt;STRONG&gt;You can use the SPLINE option in the EFFECT statement to generate spline effects.&lt;/STRONG&gt;&lt;BR /&gt;See here :&amp;nbsp;&lt;BR /&gt;Regression with restricted cubic splines in SAS &lt;BR /&gt;By Rick Wicklin on The DO Loop April 19, 2017&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/04/19/restricted-cubic-splines-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2017/04/19/restricted-cubic-splines-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See also this usage note :&lt;BR /&gt;Usage Note 57975: &lt;STRONG&gt;Understanding splines in the EFFECT statement&lt;/STRONG&gt;&lt;BR /&gt;&lt;A href="https://support.sas.com/kb/57/975.html" target="_blank"&gt;https://support.sas.com/kb/57/975.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For even more info, go here :&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/?s=effect+spline" target="_blank"&gt;https://blogs.sas.com/content/?s=effect+spline&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 16:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-predicted-values-from-modeled-data-with-transformed/m-p/919793#M45679</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-03-11T16:48:35Z</dc:date>
    </item>
  </channel>
</rss>

