<?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: Creating a set of features based off of a one date column: one-hot-encoding without blanks in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-set-of-features-based-off-of-a-one-date-column-one/m-p/587451#M167795</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;, THANK YOU SO MUCH! THIS WORKS!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a good day further.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Sep 2019 08:24:40 GMT</pubDate>
    <dc:creator>sassing</dc:creator>
    <dc:date>2019-09-10T08:24:40Z</dc:date>
    <item>
      <title>Creating a set of features based off of a one date column: one-hot-encoding without blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-set-of-features-based-off-of-a-one-date-column-one/m-p/587446#M167793</link>
      <description>&lt;P&gt;Hi SAS Community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a set of features based on a date index- that is, a set of features based on a date on one line per ID key.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is the data:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="data.PNG" style="width: 368px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32338i4023130F6087DD7C/image-size/large?v=v2&amp;amp;px=999" role="button" title="data.PNG" alt="data.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;&lt;U&gt;&lt;STRONG&gt;What I want it to look like:&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="desired_output.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32336i478A44BDCD621DD1/image-size/large?v=v2&amp;amp;px=999" role="button" title="desired_output.PNG" alt="desired_output.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I came up with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
set x;

if date_field = '30SEP2018:00:00:00.000'dt then SEP2018_BAL= amount;
else if date_field = '31OCT2018:00:00:00.000'dt then OCT2018_BAL= amount;
else if date_field = '30NOV2018:00:00:00.000'dt then NOV2018_BAL= amount;
else if date_field = '31DEC2018:00:00:00.000'dt then DEC2018_BAL= amount;
else if date_field = '31JAN2019:00:00:00.000'dt then JAN2019_BAL= amount;
else if date_field = '28FEB2019:00:00:00.000'dt then FEB2019_BAL= amount;


run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;And this is the output I am getting, which is not ideal:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="current_output.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32337i6C85000D062CBB98/image-size/large?v=v2&amp;amp;px=999" role="button" title="current_output.PNG" alt="current_output.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if you need any more info from me. Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 08:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-set-of-features-based-off-of-a-one-date-column-one/m-p/587446#M167793</guid>
      <dc:creator>sassing</dc:creator>
      <dc:date>2019-09-10T08:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a set of features based off of a one date column: one-hot-encoding without blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-set-of-features-based-off-of-a-one-date-column-one/m-p/587449#M167794</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/289319"&gt;@sassing&lt;/a&gt;&amp;nbsp;and welcome to the SAS Community &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's how I would do it&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
retain ID_key "a1_1234";
input amount date_field :anydtdtm22.;
format date_field datetime22.;
datalines;
710937.5  30SEP2018:00:00:00.000
713653.38 31OCT2018:00:00:00.000
705974.23 30NOV2018:00:00:00.000
704847.1  31DEC2018:00:00:00.000
704016.17 31JAN2019:00:00:00.000
703178.11 28FEB2019:00:00:00.000
;

data temp;
    set have;
    vn=cats(put(datepart(date_field), monyy7.), '_BAL');
run;

proc transpose data=temp out=want(drop=_:);
    by ID_key;
    id vn;
    var amount;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Sep 2019 08:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-set-of-features-based-off-of-a-one-date-column-one/m-p/587449#M167794</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-10T08:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a set of features based off of a one date column: one-hot-encoding without blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-set-of-features-based-off-of-a-one-date-column-one/m-p/587451#M167795</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;, THANK YOU SO MUCH! THIS WORKS!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a good day further.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 08:24:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-set-of-features-based-off-of-a-one-date-column-one/m-p/587451#M167795</guid>
      <dc:creator>sassing</dc:creator>
      <dc:date>2019-09-10T08:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a set of features based off of a one date column: one-hot-encoding without blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-set-of-features-based-off-of-a-one-date-column-one/m-p/587452#M167796</link>
      <description>&lt;P&gt;Anytime &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; You too&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 08:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-set-of-features-based-off-of-a-one-date-column-one/m-p/587452#M167796</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-10T08:25:12Z</dc:date>
    </item>
  </channel>
</rss>

