<?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 Do I Sum Two Variables into One New Variable in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748349#M8735</link>
    <description>That is entirely up to you, but I wouldn't replace the original data until I am absolutely sure that I have no other changes to make.  Once you overwrite the original, there's no going back.</description>
    <pubDate>Wed, 16 Jun 2021 14:21:11 GMT</pubDate>
    <dc:creator>Capt_VA_SAS</dc:creator>
    <dc:date>2021-06-16T14:21:11Z</dc:date>
    <item>
      <title>How Do I Sum Two Variables into One New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748343#M8732</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to sum two variables ('arrivals' and 'departures') into one new variable ('total_activities').&lt;/P&gt;&lt;P&gt;The data set contains about 15,000 rows and I have four datasets to work with, so I wasn't sure if there was a way to do this without using codes and cards?&lt;/P&gt;&lt;P&gt;I can always add a new column in excel and re-import the data, but I was hoping to avoid that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 13:57:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748343#M8732</guid>
      <dc:creator>evanwarrenqu</dc:creator>
      <dc:date>2021-06-16T13:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Sum Two Variables into One New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748346#M8733</link>
      <description>&lt;P&gt;Hi Evan,&lt;/P&gt;
&lt;P&gt;A quick way to do this would be to create a new column using data step code below.&lt;/P&gt;
&lt;P&gt;You could add the two columns using a '+' sign or using the SUM function.&amp;nbsp; Using the '+' sign will return a missing value when one of the inputs is missing.&amp;nbsp; Using the SUM function will implicitly impute the missing into a zero and you will get an answer.&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;data work.updated_data;
set work.original_data;
   total_activities = sum(arrivals, departures);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 14:08:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748346#M8733</guid>
      <dc:creator>Capt_VA_SAS</dc:creator>
      <dc:date>2021-06-16T14:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Sum Two Variables into One New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748347#M8734</link>
      <description>&lt;P&gt;Great thanks! And just so I know, should I replace the work.original_data with my dataset?&lt;/P&gt;&lt;P&gt;The original dataset is named "NYCW"&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 14:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748347#M8734</guid>
      <dc:creator>evanwarrenqu</dc:creator>
      <dc:date>2021-06-16T14:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Sum Two Variables into One New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748349#M8735</link>
      <description>That is entirely up to you, but I wouldn't replace the original data until I am absolutely sure that I have no other changes to make.  Once you overwrite the original, there's no going back.</description>
      <pubDate>Wed, 16 Jun 2021 14:21:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748349#M8735</guid>
      <dc:creator>Capt_VA_SAS</dc:creator>
      <dc:date>2021-06-16T14:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Sum Two Variables into One New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748350#M8736</link>
      <description>&lt;P&gt;Sorry, bad wording on my part in the question there &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What I meant was when I put the code in, should it read:&lt;/P&gt;&lt;P&gt;data work.updated_data;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;data NYCW.updated_data;&lt;/P&gt;&lt;P&gt;and same for work.original_data or NYCW.original_data&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 14:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748350#M8736</guid>
      <dc:creator>evanwarrenqu</dc:creator>
      <dc:date>2021-06-16T14:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Sum Two Variables into One New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748357#M8737</link>
      <description>&lt;P&gt;If you want to save your file to a permanent location, you will need to setup what we call a SAS library.&lt;BR /&gt;After you set this up, you can refer to it and save your files to that location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname MYDATA 'C:\some_file_folder_location' ;&amp;nbsp;

data mydata.nycw;
set work.nycw;
total_activities = sum(arrivals, departures);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;The only thing I can't tell you is where your data is currently residing.&amp;nbsp; It is on your computer and SAS is referencing it, so it must have a library name associated with it.&amp;nbsp; If you haven't already explicitly listed the library then it is either in a temporary library created during the import or it is in WORK.&amp;nbsp; WORK is not a permanent library and will be purged once you close SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 14:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748357#M8737</guid>
      <dc:creator>Capt_VA_SAS</dc:creator>
      <dc:date>2021-06-16T14:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Sum Two Variables into One New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748359#M8738</link>
      <description>&lt;P&gt;Perfect that's what I needed, thank you so very much!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 14:44:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-Do-I-Sum-Two-Variables-into-One-New-Variable/m-p/748359#M8738</guid>
      <dc:creator>evanwarrenqu</dc:creator>
      <dc:date>2021-06-16T14:44:01Z</dc:date>
    </item>
  </channel>
</rss>

