<?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: Mapping a number to mmmYYYY date format in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Mapping-a-number-to-mmmYYYY-date-format/m-p/805598#M33491</link>
    <description>&lt;P&gt;Same as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;already posted with the addition of the calculation for the base date.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 input col1 col2 $ col3;
 datalines;
1391 catA 84 
1392 catA 25
1475 76 35
;

data want;
 set have;
 if _n_=1 then base_dt=intnx('month','01jan2001'd,-1391,'b');
 retain base_dt;
 format base_dt date9.;

 date = intnx('month',base_dt,col1,'b');
 format date monyy7.;
run;

proc print data=want;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1648857622247.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70052i8BC8AC8757F01380/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1648857622247.png" alt="Patrick_0-1648857622247.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 02 Apr 2022 00:00:26 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2022-04-02T00:00:26Z</dc:date>
    <item>
      <title>Mapping a number to mmmYYYY date format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Mapping-a-number-to-mmmYYYY-date-format/m-p/805565#M33488</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a very specific problem I'm trying to tackle in SAS, but I am new to SAS.&amp;nbsp; I have a stacked dataset in SAS where a number refers to a specific date in mmmYYYY format.&amp;nbsp; I'm looking for a way to map the number in the first column (which is stacked) to the mmmYYYY that it refers to in SAS.&amp;nbsp; But I have no idea how to do this.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data looks something like....&lt;/P&gt;&lt;P&gt;col1&amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; col2&amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; col3&amp;nbsp; &amp;nbsp;|&amp;nbsp;&lt;/P&gt;&lt;P&gt;1391&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 84&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;1391&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12&lt;/P&gt;&lt;P&gt;1391&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;16&lt;/P&gt;&lt;P&gt;1392&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 25&lt;/P&gt;&lt;P&gt;1392&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 98&lt;/P&gt;&lt;P&gt;...&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ....&amp;nbsp;&lt;/P&gt;&lt;P&gt;1475&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;76&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to is&amp;nbsp;&lt;/P&gt;&lt;P&gt;col1&amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; col2&amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; col3&amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp;date&lt;/P&gt;&lt;P&gt;1391&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 84&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Jan2001&lt;/P&gt;&lt;P&gt;1391&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Jan2001&lt;/P&gt;&lt;P&gt;1391&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;16&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Jan2001&lt;/P&gt;&lt;P&gt;1392&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 25&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Feb2001&lt;/P&gt;&lt;P&gt;1392&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 98&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Feb2001&lt;/P&gt;&lt;P&gt;...&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ....&amp;nbsp;&lt;/P&gt;&lt;P&gt;1475&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;76&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;35&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Jan2008&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does SAS have a mapping feature for mapping a random number to a date?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 19:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Mapping-a-number-to-mmmYYYY-date-format/m-p/805565#M33488</guid>
      <dc:creator>kirklab</dc:creator>
      <dc:date>2022-04-01T19:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping a number to mmmYYYY date format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Mapping-a-number-to-mmmYYYY-date-format/m-p/805572#M33489</link>
      <description>&lt;P&gt;Can you please explain the logic further? How does 1391 get transformed into Jan2001???&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 20:25:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Mapping-a-number-to-mmmYYYY-date-format/m-p/805572#M33489</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-01T20:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping a number to mmmYYYY date format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Mapping-a-number-to-mmmYYYY-date-format/m-p/805573#M33490</link>
      <description>&lt;P&gt;My take:&lt;/P&gt;
&lt;PRE&gt;data have;
   input col1 col2 $ col3 ;
datalines;
1391       catA          84     
1392       catA            25
1475         76           35
;

data want; 
   set have;
   date = intnx('month','01FEB1885'd,col1,'b');
   format date monyy7.;
run;&lt;/PRE&gt;
&lt;P&gt;Basically did a reverse backdating your given example for 1391 to establish a base date to use the Intnx function, which increments date, time and datetime values, the set that in code. The default day of the month for the date will be the first day of the month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note the data step code to provide example data. Also, placing such code in a text box opened with the &amp;lt;/&amp;gt; preserves text format when pasted and sets thing aside from the general narrative.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 20:35:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Mapping-a-number-to-mmmYYYY-date-format/m-p/805573#M33490</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-01T20:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping a number to mmmYYYY date format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Mapping-a-number-to-mmmYYYY-date-format/m-p/805598#M33491</link>
      <description>&lt;P&gt;Same as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;already posted with the addition of the calculation for the base date.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 input col1 col2 $ col3;
 datalines;
1391 catA 84 
1392 catA 25
1475 76 35
;

data want;
 set have;
 if _n_=1 then base_dt=intnx('month','01jan2001'd,-1391,'b');
 retain base_dt;
 format base_dt date9.;

 date = intnx('month',base_dt,col1,'b');
 format date monyy7.;
run;

proc print data=want;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1648857622247.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70052i8BC8AC8757F01380/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1648857622247.png" alt="Patrick_0-1648857622247.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 00:00:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Mapping-a-number-to-mmmYYYY-date-format/m-p/805598#M33491</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-04-02T00:00:26Z</dc:date>
    </item>
  </channel>
</rss>

