<?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: How to square an independent variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-square-an-independent-variable/m-p/694204#M211700</link>
    <description>&lt;P&gt;As far as I know, either way works and should give the same answer (if done properly). Easy enough for you to test.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Oct 2020 10:38:45 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-10-26T10:38:45Z</dc:date>
    <item>
      <title>How to square an independent variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-square-an-independent-variable/m-p/538011#M148072</link>
      <description>&lt;P&gt;I'm having an issue squaring my X variable to create a new variable... I don't know where to place this transformation statement, or exactly what it should be. Here is my best guess so far, but it keeps telling me "Variable X2 is not found."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HW4 - Code.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27378i4DCE9778411CEC9E/image-size/large?v=v2&amp;amp;px=999" role="button" title="HW4 - Code.PNG" alt="HW4 - Code.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HW 4 - Error Log.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27379iB7C5183305616200/image-size/large?v=v2&amp;amp;px=999" role="button" title="HW 4 - Error Log.PNG" alt="HW 4 - Error Log.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2019 19:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-square-an-independent-variable/m-p/538011#M148072</guid>
      <dc:creator>mpiotro2</dc:creator>
      <dc:date>2019-02-23T19:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to square an independent variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-square-an-independent-variable/m-p/538013#M148073</link>
      <description>&lt;P&gt;Changing a LABEL in PROC CONTENTS does not create a new variable X2 nor does it assign new values to the variable. If a given observation had a value of 4, after your PROC CONTENTS it sill has a value of 4, not 16. This is all easily viewed in your data set, you could see that for yourself by simply looking at work.import1 after PROC CONTENTS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need a SAS data step to compute a variable that has new values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data import2;
    set import1;
    x2=x**2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An even simpler approach is to NOT explicitly compute x**2 by yourself prior to the regression, and to use PROC GLM for the regression, which will compute x**2 internally in the procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glm data=import1;
    model y = x x*x;
run;
quit;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2019 20:11:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-square-an-independent-variable/m-p/538013#M148073</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-02-23T20:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to square an independent variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-square-an-independent-variable/m-p/694140#M211684</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;(or anyone)&lt;/P&gt;
&lt;P&gt;I "feel" that squaring of an independent variable MUST be done INSIDE the model statement.&lt;/P&gt;
&lt;P&gt;Of course, Statistics is not about feelings, but is my intuition correct?&lt;/P&gt;
&lt;P&gt;Or can it be done either way: Inside or outside?&lt;/P&gt;</description>
      <pubDate>Sun, 25 Oct 2020 23:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-square-an-independent-variable/m-p/694140#M211684</guid>
      <dc:creator>MelissaM</dc:creator>
      <dc:date>2020-10-25T23:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to square an independent variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-square-an-independent-variable/m-p/694204#M211700</link>
      <description>&lt;P&gt;As far as I know, either way works and should give the same answer (if done properly). Easy enough for you to test.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 10:38:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-square-an-independent-variable/m-p/694204#M211700</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-26T10:38:45Z</dc:date>
    </item>
  </channel>
</rss>

