<?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: Computing A New Column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/730597#M227516</link>
    <description>&lt;P&gt;This worked thank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just had to add an = after both &amp;lt; to include both the first and last date in that season.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again, great help.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Apr 2021 03:44:51 GMT</pubDate>
    <dc:creator>EM_G</dc:creator>
    <dc:date>2021-04-01T03:44:51Z</dc:date>
    <item>
      <title>Computing A New Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/729965#M227235</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a new SAS 9.4 user, trying to compute a new column using a IF-THEN statement. The below table is my weather data, the column I am trying to compute is season, for example under the column name Season; from the 1st of Sep 2017 to 30th of November 2017 from the date column will also appear under Season as Spring17.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EM_G_3-1617082324715.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56650i2C21DFE62A8F89DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EM_G_3-1617082324715.png" alt="EM_G_3-1617082324715.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is an unsuccessful attempt.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EM_G_2-1617082124379.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56649iF2C3C82A60340F5B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EM_G_2-1617082124379.png" alt="EM_G_2-1617082124379.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 05:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/729965#M227235</guid>
      <dc:creator>EM_G</dc:creator>
      <dc:date>2021-03-30T05:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Computing A New Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/729967#M227237</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if '01jan2020'd &amp;lt; DATE &amp;lt; '31mar2020'd then SEASON='Winter2020';&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 06:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/729967#M227237</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-30T06:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Computing A New Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/730013#M227266</link>
      <description>&lt;P&gt;Alternative way to assign value to season is by checking the month:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 set have;
      length season $8;
       mm = month(date);
       if 03 le mm le 05 then season = 'Automn'; else
       if 06 le mm le 08 then season = 'Winter' ; else
       if 09 le mm le 11 then season = 'Spring'; else
       if mm in (01 02 12) then season = 'Summer';
       season = cat(season, put(date,year2.));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Mar 2021 09:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/730013#M227266</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-03-30T09:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Computing A New Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/730582#M227506</link>
      <description>&lt;P&gt;I like this solution, but the trouble is I have three different years and need to be able to identify them in season also. By checking the month only I will have three summers etc. Can I specify year also?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 02:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/730582#M227506</guid>
      <dc:creator>EM_G</dc:creator>
      <dc:date>2021-04-01T02:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Computing A New Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/730597#M227516</link>
      <description>&lt;P&gt;This worked thank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just had to add an = after both &amp;lt; to include both the first and last date in that season.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again, great help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 03:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/730597#M227516</guid>
      <dc:creator>EM_G</dc:creator>
      <dc:date>2021-04-01T03:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Computing A New Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/730599#M227518</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353220"&gt;@EM_G&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I like this solution, but the trouble is I have three different years and need to be able to identify them in season also. By checking the month only I will have three summers etc. Can I specify year also?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You missed the line where I concatenate the year to the season derived from the month format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;season = cat(season, put(date,year2.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and, of course, you can replace the &lt;STRONG&gt;year2.&lt;/STRONG&gt; format with &lt;STRONG&gt;year4.&lt;/STRONG&gt; format, if preferd.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thus you are free to work with any year and any number of years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 04:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/730599#M227518</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-04-01T04:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Computing A New Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/730604#M227521</link>
      <description>&lt;P&gt;My apologies, I didn't realize how that worked. I understand now and this works also, so thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 06:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Computing-A-New-Column/m-p/730604#M227521</guid>
      <dc:creator>EM_G</dc:creator>
      <dc:date>2021-04-01T06:03:34Z</dc:date>
    </item>
  </channel>
</rss>

