<?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 a new variable that adds up a total from multiple other variables? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/707016#M26432</link>
    <description>&lt;P&gt;If you use the + instead of Sum you get missing value result if any of the variables have missing values. So that is something to consider as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
    v1 =1;
    v2 =0;
    v3 =.;
    v4 = 3;
    v5 = 4;
    tot = v1 + v2 + v3 + v4 + v5;
    total = sum (of v1-v5);
run; &lt;/PRE&gt;</description>
    <pubDate>Fri, 18 Dec 2020 17:21:53 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-12-18T17:21:53Z</dc:date>
    <item>
      <title>How to create a new variable that adds up a total from multiple other variables?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706877#M26393</link>
      <description>&lt;P&gt;Hello, I know the title isn't very clear and I apologize for that and here is some info to help make what I'm asking about make more sense:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a first-semester student in a social science/human ecology PhD program, so I am looking at behaviors and outcomes and pretty new to this. I am using a secondary dataset and I&amp;nbsp;am trying to create a scale variable (that has been created and used this way in other research- though was concerned with a different outcome/relationships. Including using the same secondary data I am using- though from a different wave of the data). I am not concerned with the degree to which a certain behavior or circumstance is present, just whether or not it is present and the effect of that on a particular outcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now I have created 10 binary dummy variables that are either 0 or 1 (0=behavior/circumstance is not present, 1=behavior/circumstance is present). I want to now create a new variable that will add up the dummy variables to have a value of 0-10, so that in the end the variable will represent a score from 0-10. I just am not sure how to do that from here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help/direction.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2020 04:52:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706877#M26393</guid>
      <dc:creator>Calyn</dc:creator>
      <dc:date>2020-12-18T04:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable that adds up a total from multiple other variables?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706884#M26396</link>
      <description>Do you mean this?  In a DATA step:&lt;BR /&gt;&lt;BR /&gt;new_varuable = sum(of dummy1-dummy10);</description>
      <pubDate>Fri, 18 Dec 2020 06:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706884#M26396</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-12-18T06:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable that adds up a total from multiple other variables?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706885#M26397</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2020 06:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706885#M26397</guid>
      <dc:creator>Calyn</dc:creator>
      <dc:date>2020-12-18T06:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable that adds up a total from multiple other variables?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706893#M26401</link>
      <description>&lt;P&gt;I kept getting an error, so I searched using the sum terminology and was able to search for that for other options. So I just wanted to follow up with what I ended up doing that seems to have worked. I don't know enough about SAS to know why or why not, but wanted to follow up to make sure this looked alright?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;DATA work.set_SAS; SET filesave.set_SAS;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;/*creating new variable for scale*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;NEW=.;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;/*recoding new variable for scale*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;NEW=var1-var2-var3-var4-var5-var6-var7-var8-var9-var10;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;LABEL NEW= "Scale (0-10)";&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;RUN; &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2020 07:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706893#M26401</guid>
      <dc:creator>Calyn</dc:creator>
      <dc:date>2020-12-18T07:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable that adds up a total from multiple other variables?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706905#M26405</link>
      <description>&lt;P&gt;If you post the log with the error, it should be easy to diagnose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your formula runs without error, but isn't the same thing.&amp;nbsp; You would need to change the minus signs to plus signs to get the right result.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2020 08:41:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706905#M26405</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-12-18T08:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable that adds up a total from multiple other variables?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706973#M26426</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2020 15:13:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/706973#M26426</guid>
      <dc:creator>Calyn</dc:creator>
      <dc:date>2020-12-18T15:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable that adds up a total from multiple other variables?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/707016#M26432</link>
      <description>&lt;P&gt;If you use the + instead of Sum you get missing value result if any of the variables have missing values. So that is something to consider as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
    v1 =1;
    v2 =0;
    v3 =.;
    v4 = 3;
    v5 = 4;
    tot = v1 + v2 + v3 + v4 + v5;
    total = sum (of v1-v5);
run; &lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Dec 2020 17:21:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/707016#M26432</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-12-18T17:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable that adds up a total from multiple other variables?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/707033#M26437</link>
      <description>Thank you! I found that out and also realized I had been messing up creating some of my empty variables so that they actually pulled the values over correctly. So I've been rewriting and checking the variables means this time to make sure. That and figuring out how to sum the scale variable so that it works has basically been my morning &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;I really appreciate the help with this! I know that it will get easier, but right now it feels like one big game of whack a mole &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;</description>
      <pubDate>Fri, 18 Dec 2020 17:54:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-that-adds-up-a-total-from-multiple/m-p/707033#M26437</guid>
      <dc:creator>Calyn</dc:creator>
      <dc:date>2020-12-18T17:54:28Z</dc:date>
    </item>
  </channel>
</rss>

