<?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: Adding a new column to existing dataset in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Adding-a-new-column-to-existing-dataset/m-p/696179#M25233</link>
    <description>&lt;P&gt;See if you can use this as a template.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data permlib.want;
   set permlib.have;
   if year(Incident_Date) not in (2002 : 2017) or
      year(Date_Received) not in (2002 : 2017) or
      Incident_Date &amp;gt; Date_Received then Date_Issues = "Need Review";
   label Date_Issues = "Date Issues";
   format Incident_Date Date_Received date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 Nov 2020 13:08:28 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2020-11-03T13:08:28Z</dc:date>
    <item>
      <title>Adding a new column to existing dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-a-new-column-to-existing-dataset/m-p/696176#M25231</link>
      <description>&lt;P&gt;I'm struggling through learning SAS here and I have a simple question that I cannot for the life of me figure out&lt;/P&gt;&lt;P&gt;I need to add a new column to my dataset that is in an existing permanent library with some conditions, specifically&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"7. Create a new column to indicate date issues."&lt;/P&gt;&lt;P&gt;• You create a new column named Date_Issues with a value of Needs Review to indicate that a row has a date issue. Date issues consist of the following: – a missing value for Incident_Date or Date_Received – an Incident_Date or Date_Received value out of the predefined year range of 2002 through 2017 – an Incident_Date value that occurs after the Date_Received value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and secondly, how does one create a permanent labels and formats?&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 12:59:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-a-new-column-to-existing-dataset/m-p/696176#M25231</guid>
      <dc:creator>kat6</dc:creator>
      <dc:date>2020-11-03T12:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a new column to existing dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-a-new-column-to-existing-dataset/m-p/696177#M25232</link>
      <description>&lt;P&gt;Add new column to a data set in a permanent library, and a label and a format like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname perm "\myfiles\subfolder1"; /* You need to specify the exact folder name for your data */
data perm.have2;
     set perm.have;
     if missing(date_received) then date_issues='Needs Review';
     label date_issues='Millard Fillmore';
     format date_received date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I leave it up to you to add the other conditions you mentioned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code above adds a new column and saves that new column in a new data set named HAVE2, this is good practice not to overwrite your original data set. If you really need it in the original data set HAVE, then just remove the 2.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 13:08:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-a-new-column-to-existing-dataset/m-p/696177#M25232</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-11-03T13:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a new column to existing dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-a-new-column-to-existing-dataset/m-p/696179#M25233</link>
      <description>&lt;P&gt;See if you can use this as a template.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data permlib.want;
   set permlib.have;
   if year(Incident_Date) not in (2002 : 2017) or
      year(Date_Received) not in (2002 : 2017) or
      Incident_Date &amp;gt; Date_Received then Date_Issues = "Need Review";
   label Date_Issues = "Date Issues";
   format Incident_Date Date_Received date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Nov 2020 13:08:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-a-new-column-to-existing-dataset/m-p/696179#M25233</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-03T13:08:28Z</dc:date>
    </item>
  </channel>
</rss>

