<?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: Trying to fit regression using indicator variables in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251244#M13264</link>
    <description>&lt;P&gt;See my comments in red on your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data &lt;STRONG&gt;indicatorVariableNCBirth;&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;set NCBirth;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;When creating indicator variables, it's best to use 1/0, not 5/0. Change these to 1/0 binary coding.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Additionally, if your categorical variable has N levels, you need N-1 Indicator variables to represent the variable. Including N is know as overparameterization.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;if momrace = 'white' then white=4;&lt;BR /&gt;else white = 0;&lt;BR /&gt;if momrace = 'hispanic' then hispanic=3;&lt;BR /&gt;else hispanic = 0;&lt;BR /&gt;if momrace = 'black' then black = 2;&lt;BR /&gt;else black = 0;&lt;BR /&gt;if momrace = 'other' then other=1;&lt;BR /&gt;else other=0;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc reg data=indicatorvariablencbirth;&lt;BR /&gt;model Birthweightoz = momrace; &amp;lt;-&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Change this to include N-1 of your indicator variables that are code 0/1. Then you'll get estimates.&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Give your data structure I would also look at boxplots for the weight by race to&amp;nbsp;visualize the comparison.&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Feb 2016 19:02:52 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-02-19T19:02:52Z</dc:date>
    <item>
      <title>Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251170#M13247</link>
      <description>&lt;P&gt;I am trying to fit a regression using indicator variables. its not working and i dont understand why.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the code i used is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data indicatorVariableNCBirth;&lt;BR /&gt;set NCBirth;&lt;BR /&gt;if momrace = 'white' then white=4;&lt;BR /&gt;else white = 0;&lt;BR /&gt;if momrace = 'hispanic' then hispanic=3;&lt;BR /&gt;else hispanic = 0;&lt;BR /&gt;if momrace = 'black' then black = 2;&lt;BR /&gt;else black = 0;&lt;BR /&gt;if momrace = 'other' then other=1;&lt;BR /&gt;else other=0;&lt;BR /&gt;run;&lt;BR /&gt;Proc print data=indicatorvariablencbirth;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc reg data=indicatorvariablencbirth;&lt;BR /&gt;model Birthweightoz = momrace;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the error message i receive after trying to carry out the regression model:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasError"&gt;ERROR: Variable MomRace in list does not match type prescribed for this list.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;NOTE: The previous statement has been deleted.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;58 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;WARNING: No variables specified for an SSCP matrix. Execution terminating.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE REG used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.04 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.04 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 19 Feb 2016 15:52:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251170#M13247</guid>
      <dc:creator>MadQuidd</dc:creator>
      <dc:date>2016-02-19T15:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251176#M13248</link>
      <description>&lt;P&gt;Why are you modeling the variable that you've created indicators for? Should you be using the new indicator variables instead?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your first piece of code is entirely separate from your second. They don't reference the same data set or connected in any way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 16:02:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251176#M13248</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-19T16:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251186#M13251</link>
      <description>&lt;P&gt;I created a sub set of the original data set to include the indicator variables. When i fit the regression model to the created indicator variables it doesnt work. I dont know what I am doing wrong but I know that my output either gives me errors or it creates an off looking output statement. I&lt;/P&gt;&lt;P&gt;I used the following code and got a weird output that is wrong:&lt;/P&gt;&lt;P&gt;proc reg data=indicatorvariablencbirth;&lt;BR /&gt;model Birthweightoz = white hispanic black other;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 16:15:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251186#M13251</guid>
      <dc:creator>MadQuidd</dc:creator>
      <dc:date>2016-02-19T16:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251191#M13252</link>
      <description>&lt;P&gt;The specific error you are receiving because the varaible MOMRACE is character as evidenced by your code:&lt;/P&gt;
&lt;P&gt;if momrace = 'white' then white=4;&lt;BR /&gt;else white = 0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Prog Reg requires the variables on the model statement to be numeric.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 16:18:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251191#M13252</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-02-19T16:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251192#M13253</link>
      <description>&lt;P&gt;Explain how your data is structured, ideally provide sample data.&lt;/P&gt;
&lt;P&gt;Then show what your model should be mathematically and we can help with the code.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 16:19:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251192#M13253</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-19T16:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251220#M13255</link>
      <description>&lt;P&gt;What type of output are you expecting to get?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 17:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251220#M13255</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-02-19T17:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251223#M13256</link>
      <description>&lt;P&gt;Thats my problem I am not entirely sure what the final regression line is meant to look like but the output data I am getting are straiht lines. For all I know it could be correct but &amp;nbsp;i am getting vertical lines.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im trying to attach the write up of the output to help explain my confusion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 17:56:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251223#M13256</guid>
      <dc:creator>MadQuidd</dc:creator>
      <dc:date>2016-02-19T17:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251225#M13258</link>
      <description>&lt;P&gt;Whats your basic model?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Birthweight&amp;nbsp;= B1*white + B2*asian + B3*other&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 18:15:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251225#M13258</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-19T18:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251227#M13260</link>
      <description>&lt;P&gt;I honestly dont know what you mean when you say basic model. But here is a protion of the original data that might help answering my question because I dont know what I am doing wrong.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really do appreciate all of the help in tying to figure this out thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is the code &amp;nbsp;i used to import the csv data&amp;amp;colon;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FILENAME CSV "/folders/myfolders/3064data/NCbirths_RaceStudy.csv" TERMSTR=CRLF;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC IMPORT DATAFILE=CSV&lt;BR /&gt;OUT=NCBirth&lt;BR /&gt;DBMS=CSV&lt;BR /&gt;REPLACE;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;/** Print the results. **/&lt;/P&gt;&lt;P&gt;PROC PRINT DATA=NCBirth (obs=100); RUN;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 18:24:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251227#M13260</guid>
      <dc:creator>MadQuidd</dc:creator>
      <dc:date>2016-02-19T18:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251228#M13261</link>
      <description>&lt;P&gt;What question are you trying to answer? Do you have a hypothesis?&lt;/P&gt;
&lt;P&gt;Are you familiar with linear regression?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data is great, but you have to know what you want out of it as well.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 18:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251228#M13261</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-19T18:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251233#M13262</link>
      <description>&lt;P&gt;All i want to do is produce a parameters estimates output table from which I can gather more information on the data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to see if i can accurately use 'momrace' to predict birthweights while using the indicator variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 18:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251233#M13262</guid>
      <dc:creator>MadQuidd</dc:creator>
      <dc:date>2016-02-19T18:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251244#M13264</link>
      <description>&lt;P&gt;See my comments in red on your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data &lt;STRONG&gt;indicatorVariableNCBirth;&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;set NCBirth;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;When creating indicator variables, it's best to use 1/0, not 5/0. Change these to 1/0 binary coding.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Additionally, if your categorical variable has N levels, you need N-1 Indicator variables to represent the variable. Including N is know as overparameterization.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;if momrace = 'white' then white=4;&lt;BR /&gt;else white = 0;&lt;BR /&gt;if momrace = 'hispanic' then hispanic=3;&lt;BR /&gt;else hispanic = 0;&lt;BR /&gt;if momrace = 'black' then black = 2;&lt;BR /&gt;else black = 0;&lt;BR /&gt;if momrace = 'other' then other=1;&lt;BR /&gt;else other=0;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc reg data=indicatorvariablencbirth;&lt;BR /&gt;model Birthweightoz = momrace; &amp;lt;-&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Change this to include N-1 of your indicator variables that are code 0/1. Then you'll get estimates.&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Give your data structure I would also look at boxplots for the weight by race to&amp;nbsp;visualize the comparison.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 19:02:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251244#M13264</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-19T19:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251249#M13265</link>
      <description>&lt;P&gt;What do you mean when you say N-1 statement. Do mean add an additional variable to include the number of races minus one?&lt;/P&gt;&lt;P&gt;I dont really know what you mean by adding that statement or how to do that.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don understand taking the 0/5 out of the equation having a simple binary is more appropriate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 19:14:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251249#M13265</guid>
      <dc:creator>MadQuidd</dc:creator>
      <dc:date>2016-02-19T19:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251267#M13266</link>
      <description>&lt;P&gt;Perhaps reading some linear regression tutorials would be helpful.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/webbooks/reg/chapter3/sasreg3.htm" target="_blank"&gt;http://www.ats.ucla.edu/stat/sas/webbooks/reg/chapter3/sasreg3.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As well, the SAS Statistical e-course which covers linear regression is free&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 20:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251267#M13266</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-19T20:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fit regression using indicator variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251268#M13267</link>
      <description>&lt;P&gt;I figured it out from your pervious post! Thank you so much for the help I wa truely lost and really needed it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 20:16:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Trying-to-fit-regression-using-indicator-variables/m-p/251268#M13267</guid>
      <dc:creator>MadQuidd</dc:creator>
      <dc:date>2016-02-19T20:16:35Z</dc:date>
    </item>
  </channel>
</rss>

