<?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 create new variable of two existed variables using their average? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-variable-of-two-existed-variables-using-their/m-p/727293#M226177</link>
    <description>&lt;P&gt;It really helps to provide a bit more structured details on the question. I am not sure whether you mean for each observation in a data set or of summarized data across the entire data set or a subset within the data.&lt;/P&gt;
&lt;P&gt;If you want the mean on each observation of a data set then in a data step use the mean function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
    x=4;
    y=8;
    average=mean(x, y);
run;&lt;/PRE&gt;
&lt;P&gt;Mean, and the associated other data step statistics functions like Min, Max, Std (standard deviation) will return the requested statistic based on the non-missing values of a list of variables (can be &lt;STRONG&gt;way &lt;/STRONG&gt;more than 2).&lt;/P&gt;</description>
    <pubDate>Thu, 18 Mar 2021 03:16:26 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-03-18T03:16:26Z</dc:date>
    <item>
      <title>How to create new variable of two existed variables using their average?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-variable-of-two-existed-variables-using-their/m-p/727289#M226173</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS and I'm facing a problem figuring out:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to create a new variable, which is the average of two existed variables (e.g. new variable=SBP, existed variable1=SPB1,&amp;nbsp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;existed variable2=SPB2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 02:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-variable-of-two-existed-variables-using-their/m-p/727289#M226173</guid>
      <dc:creator>Nouf2</dc:creator>
      <dc:date>2021-03-18T02:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new variable of two existed variables using their average?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-variable-of-two-existed-variables-using-their/m-p/727293#M226177</link>
      <description>&lt;P&gt;It really helps to provide a bit more structured details on the question. I am not sure whether you mean for each observation in a data set or of summarized data across the entire data set or a subset within the data.&lt;/P&gt;
&lt;P&gt;If you want the mean on each observation of a data set then in a data step use the mean function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
    x=4;
    y=8;
    average=mean(x, y);
run;&lt;/PRE&gt;
&lt;P&gt;Mean, and the associated other data step statistics functions like Min, Max, Std (standard deviation) will return the requested statistic based on the non-missing values of a list of variables (can be &lt;STRONG&gt;way &lt;/STRONG&gt;more than 2).&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 03:16:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-variable-of-two-existed-variables-using-their/m-p/727293#M226177</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-18T03:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new variable of two existed variables using their average?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-variable-of-two-existed-variables-using-their/m-p/727521#M226304</link>
      <description>&lt;P&gt;Thank you for your reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mean I have a dataset with 14 different variables, two of them are named (SBP1 and SBP2).&lt;/P&gt;&lt;P&gt;I want to create a new variable that it is not part of the 14 existed variables of the dataset ( I will name it SBP). This new variable has to be the mean of both SBP1 and SBP2 variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe the code has to contain some order to create a new variable then it calculate the mean to create the values of this new proposed variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: I am taking Biostatistics course and we must use SAS, I am from medical background that's why it's tough for me to understand how it works!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 18:58:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-variable-of-two-existed-variables-using-their/m-p/727521#M226304</guid>
      <dc:creator>Nouf2</dc:creator>
      <dc:date>2021-03-18T18:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new variable of two existed variables using their average?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-variable-of-two-existed-variables-using-their/m-p/727571#M226315</link>
      <description>&lt;P&gt;So if your existing dataset is named HAVE then data step will generate a new dataset named WANT that has the new SBP variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  sbp=mean(sbp1,sbp2);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So if you also DBP1 and DBP2 then you just add another line to create DBP also.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  sbp=mean(sbp1,sbp2);
  dbp=mean(dbp1,dbp2);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Mar 2021 20:57:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-variable-of-two-existed-variables-using-their/m-p/727571#M226315</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-18T20:57:33Z</dc:date>
    </item>
  </channel>
</rss>

