<?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 New to stats- trying to write code for multiple linear regression using sex and age as predictors in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/New-to-stats-trying-to-write-code-for-multiple-linear-regression/m-p/883869#M43763</link>
    <description>&lt;P&gt;Hello, this question may be relatively simple, I am just starting to learn all this so thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To simplify my data, let's say I have 1 outcome in 37 subjects. Those subjects were technically allocated to two age groups (young adult and senior), but I also want to analyse the results continuously instead of grouped by age. They were also of both sexes so I want to see if that also has an effect on the outcome. My data, for example, can look something like this (I have changed the outcome values for testing purposes):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Data;&lt;BR /&gt;input Sex$ Age Value;&lt;BR /&gt;cards;&lt;BR /&gt;M	13	1
M	3	0.5
F	2	0.6
M	3	0.5
M	3	0.5
M	3	0.5
F	1	0.6
F	11	1.2
F	2	0.6
M	3	0.5
M	13	1
F	2	0.6
F	3	0.6
F	3	0.6
M	9	1
M	1	0.5
M	9	1
M	9	1
F	13	1.2
M	11	1
F	11	1.2
M	11	1
M	3	0.5
F	3	0.6
M	3	0.5
M	1	0.5
M	16	1
M	11	1
M	3	0.5
M	1	0.5
M	2	0.5
F	9	1.2
F	9	1.2
M	3	0.5
F	2	0.6
F	12	1.2
F	9	1.2&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have other predictors I'd like to look into as well such as weight, date sample was collected, and so on, but am not sure if I can just add them here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would I go about testing to see if age and sex have an impact on the Value? So far I have tried this (inserted below), but it does not like the sex variable. Also, could I include other predictors into this same code without having to run another one?&lt;/P&gt;&lt;PRE&gt;/*Test Data*/
Data;
input Sex$ Age Value;
cards;
M	13	1
M	3	0.5
F	2	0.6
M	3	0.5
M	3	0.5
M	3	0.5
F	1	0.6
F	11	1.2
F	2	0.6
M	3	0.5
M	13	1
F	2	0.6
F	3	0.6
F	3	0.6
M	9	1
M	1	0.5
M	9	1
M	9	1
F	13	1.2
M	11	1
F	11	1.2
M	11	1
M	3	0.5
F	3	0.6
M	3	0.5
M	1	0.5
M	16	1
M	11	1
M	3	0.5
M	1	0.5
M	2	0.5
F	9	1.2
F	9	1.2
M	3	0.5
F	2	0.6
F	12	1.2
F	9	1.2


;
run;
proc reg;
model Value= Age Sex;
run;
proc reg;
model Value= Age;
run;
proc reg;
model Value= Sex;
run;
Proc reg;
model Value= Age Sex / selection= stepwise slentry=0.05;
run;
proc corr;
var Sex Age Value;
run;&lt;/PRE&gt;&lt;P&gt;I have taken one stats course so far and this was not included, so I am a bit out of my wheelhouse on this!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much in advance,&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jul 2023 23:47:41 GMT</pubDate>
    <dc:creator>kplbug8</dc:creator>
    <dc:date>2023-07-06T23:47:41Z</dc:date>
    <item>
      <title>New to stats- trying to write code for multiple linear regression using sex and age as predictors</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/New-to-stats-trying-to-write-code-for-multiple-linear-regression/m-p/883869#M43763</link>
      <description>&lt;P&gt;Hello, this question may be relatively simple, I am just starting to learn all this so thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To simplify my data, let's say I have 1 outcome in 37 subjects. Those subjects were technically allocated to two age groups (young adult and senior), but I also want to analyse the results continuously instead of grouped by age. They were also of both sexes so I want to see if that also has an effect on the outcome. My data, for example, can look something like this (I have changed the outcome values for testing purposes):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Data;&lt;BR /&gt;input Sex$ Age Value;&lt;BR /&gt;cards;&lt;BR /&gt;M	13	1
M	3	0.5
F	2	0.6
M	3	0.5
M	3	0.5
M	3	0.5
F	1	0.6
F	11	1.2
F	2	0.6
M	3	0.5
M	13	1
F	2	0.6
F	3	0.6
F	3	0.6
M	9	1
M	1	0.5
M	9	1
M	9	1
F	13	1.2
M	11	1
F	11	1.2
M	11	1
M	3	0.5
F	3	0.6
M	3	0.5
M	1	0.5
M	16	1
M	11	1
M	3	0.5
M	1	0.5
M	2	0.5
F	9	1.2
F	9	1.2
M	3	0.5
F	2	0.6
F	12	1.2
F	9	1.2&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have other predictors I'd like to look into as well such as weight, date sample was collected, and so on, but am not sure if I can just add them here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would I go about testing to see if age and sex have an impact on the Value? So far I have tried this (inserted below), but it does not like the sex variable. Also, could I include other predictors into this same code without having to run another one?&lt;/P&gt;&lt;PRE&gt;/*Test Data*/
Data;
input Sex$ Age Value;
cards;
M	13	1
M	3	0.5
F	2	0.6
M	3	0.5
M	3	0.5
M	3	0.5
F	1	0.6
F	11	1.2
F	2	0.6
M	3	0.5
M	13	1
F	2	0.6
F	3	0.6
F	3	0.6
M	9	1
M	1	0.5
M	9	1
M	9	1
F	13	1.2
M	11	1
F	11	1.2
M	11	1
M	3	0.5
F	3	0.6
M	3	0.5
M	1	0.5
M	16	1
M	11	1
M	3	0.5
M	1	0.5
M	2	0.5
F	9	1.2
F	9	1.2
M	3	0.5
F	2	0.6
F	12	1.2
F	9	1.2


;
run;
proc reg;
model Value= Age Sex;
run;
proc reg;
model Value= Age;
run;
proc reg;
model Value= Sex;
run;
Proc reg;
model Value= Age Sex / selection= stepwise slentry=0.05;
run;
proc corr;
var Sex Age Value;
run;&lt;/PRE&gt;&lt;P&gt;I have taken one stats course so far and this was not included, so I am a bit out of my wheelhouse on this!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much in advance,&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 23:47:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/New-to-stats-trying-to-write-code-for-multiple-linear-regression/m-p/883869#M43763</guid>
      <dc:creator>kplbug8</dc:creator>
      <dc:date>2023-07-06T23:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: New to stats- trying to write code for multiple linear regression using sex and age as predictor</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/New-to-stats-trying-to-write-code-for-multiple-linear-regression/m-p/883973#M43775</link>
      <description>&lt;P&gt;Sex is a categorical predictor and REG does not handle character variables. You will need to either manually dummy code that variable or use a different proc (recommended). In that case I would recommend PROC GLM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would highly, highly recommend giving your &lt;STRONG&gt;data set names&lt;/STRONG&gt;. Makes it much easier to trace your code as it gets longer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glm data=responses;
class sex;
model value =  age sex;
run;

proc glm data=responses;
model value= age;
run;

proc glm data=responses;
class sex;
model value = sex;
run;

proc corr data=responses;
var age value;
run;

proc sort data=responses;
by sex;
run;

proc corr data=responses;
by sex;
var age value;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://www.sas.com/en_ca/training/offers/free-training.html" target="_self"&gt;Note the SAS Stats training course is free.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/445862"&gt;@kplbug8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello, this question may be relatively simple, I am just starting to learn all this so thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To simplify my data, let's say I have 1 outcome in 37 subjects. Those subjects were technically allocated to two age groups (young adult and senior), but I also want to analyse the results continuously instead of grouped by age. They were also of both sexes so I want to see if that also has an effect on the outcome. My data, for example, can look something like this (I have changed the outcome values for testing purposes):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;Data;&lt;BR /&gt;input Sex$ Age Value;&lt;BR /&gt;cards;&lt;BR /&gt;M	13	1
M	3	0.5
F	2	0.6
M	3	0.5
M	3	0.5
M	3	0.5
F	1	0.6
F	11	1.2
F	2	0.6
M	3	0.5
M	13	1
F	2	0.6
F	3	0.6
F	3	0.6
M	9	1
M	1	0.5
M	9	1
M	9	1
F	13	1.2
M	11	1
F	11	1.2
M	11	1
M	3	0.5
F	3	0.6
M	3	0.5
M	1	0.5
M	16	1
M	11	1
M	3	0.5
M	1	0.5
M	2	0.5
F	9	1.2
F	9	1.2
M	3	0.5
F	2	0.6
F	12	1.2
F	9	1.2&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have other predictors I'd like to look into as well such as weight, date sample was collected, and so on, but am not sure if I can just add them here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would I go about testing to see if age and sex have an impact on the Value? So far I have tried this (inserted below), but it does not like the sex variable. Also, could I include other predictors into this same code without having to run another one?&lt;/P&gt;
&lt;PRE&gt;/*Test Data*/
Data;
input Sex$ Age Value;
cards;
M	13	1
M	3	0.5
F	2	0.6
M	3	0.5
M	3	0.5
M	3	0.5
F	1	0.6
F	11	1.2
F	2	0.6
M	3	0.5
M	13	1
F	2	0.6
F	3	0.6
F	3	0.6
M	9	1
M	1	0.5
M	9	1
M	9	1
F	13	1.2
M	11	1
F	11	1.2
M	11	1
M	3	0.5
F	3	0.6
M	3	0.5
M	1	0.5
M	16	1
M	11	1
M	3	0.5
M	1	0.5
M	2	0.5
F	9	1.2
F	9	1.2
M	3	0.5
F	2	0.6
F	12	1.2
F	9	1.2


;
run;
proc reg;
model Value= Age Sex;
run;
proc reg;
model Value= Age;
run;
proc reg;
model Value= Sex;
run;
Proc reg;
model Value= Age Sex / selection= stepwise slentry=0.05;
run;
proc corr;
var Sex Age Value;
run;&lt;/PRE&gt;
&lt;P&gt;I have taken one stats course so far and this was not included, so I am a bit out of my wheelhouse on this!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much in advance,&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Fri, 07 Jul 2023 16:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/New-to-stats-trying-to-write-code-for-multiple-linear-regression/m-p/883973#M43775</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-07-07T16:01:06Z</dc:date>
    </item>
  </channel>
</rss>

