<?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 Convert Macro YYYYMM to Dataset variable monyy7. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-Macro-YYYYMM-to-Dataset-variable-monyy7/m-p/773097#M245536</link>
    <description>&lt;P&gt;I have this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let yyyymm=202109;&lt;BR /&gt;data temp;&lt;BR /&gt;format yearmonth monyy7.;&lt;BR /&gt;yearmonth=&amp;amp;yyyymm.;&lt;BR /&gt;run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The resulting yearmonth variable has value "&lt;STRONG&gt;MAY2513&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want:&lt;/P&gt;&lt;P&gt;It should be '&lt;STRONG&gt;SEP2021&lt;/STRONG&gt;'&lt;/P&gt;</description>
    <pubDate>Fri, 08 Oct 2021 17:16:55 GMT</pubDate>
    <dc:creator>david27</dc:creator>
    <dc:date>2021-10-08T17:16:55Z</dc:date>
    <item>
      <title>Convert Macro YYYYMM to Dataset variable monyy7.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Macro-YYYYMM-to-Dataset-variable-monyy7/m-p/773097#M245536</link>
      <description>&lt;P&gt;I have this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let yyyymm=202109;&lt;BR /&gt;data temp;&lt;BR /&gt;format yearmonth monyy7.;&lt;BR /&gt;yearmonth=&amp;amp;yyyymm.;&lt;BR /&gt;run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The resulting yearmonth variable has value "&lt;STRONG&gt;MAY2513&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want:&lt;/P&gt;&lt;P&gt;It should be '&lt;STRONG&gt;SEP2021&lt;/STRONG&gt;'&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 17:16:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Macro-YYYYMM-to-Dataset-variable-monyy7/m-p/773097#M245536</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2021-10-08T17:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Macro YYYYMM to Dataset variable monyy7.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Macro-YYYYMM-to-Dataset-variable-monyy7/m-p/773099#M245538</link>
      <description>&lt;P&gt;If you want the variable YEARMONTH to work with a date type format, such as MONYY, then it has to have date values, not random numbers like&amp;nbsp;202,109.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;yearmonth=input("&amp;amp;yyyymm.01",yymmdd8.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 17:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Macro-YYYYMM-to-Dataset-variable-monyy7/m-p/773099#M245538</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-08T17:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Macro YYYYMM to Dataset variable monyy7.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Macro-YYYYMM-to-Dataset-variable-monyy7/m-p/773103#M245539</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/215179"&gt;@david27&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;In SAS 202,109 is a number it is not a date. SAS stores dates as the number of days since 01/01/1960 (day 0), so 202109 is a day in May 2513.&lt;BR /&gt;What you need to do is convert 2021-09 into a &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/basess/p1m2pok52uqfc3n16ebk28rrm7pl.htm" target="_self"&gt;SAS date value&lt;/A&gt;&lt;BR /&gt;There's a number of ways to do this, probably the simplest is the &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0bo5thbfrcab1n1menkqxq2suiv.htm" target="_self"&gt;MDY function&lt;/A&gt;&lt;BR /&gt;Please review the documentation links and feel free to ask any additional questions&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 17:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Macro-YYYYMM-to-Dataset-variable-monyy7/m-p/773103#M245539</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2021-10-08T17:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Macro YYYYMM to Dataset variable monyy7.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Macro-YYYYMM-to-Dataset-variable-monyy7/m-p/773104#M245540</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let yyyymm=202109;

data temp;
format yearmonth monyy7.;
yearmonth=input("&amp;amp;yyyymm.", yymmn6.);
run;

proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/215179"&gt;@david27&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let yyyymm=202109;&lt;BR /&gt;data temp;&lt;BR /&gt;format yearmonth monyy7.;&lt;BR /&gt;yearmonth=&amp;amp;yyyymm.;&lt;BR /&gt;run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The resulting yearmonth variable has value "&lt;STRONG&gt;MAY2513&lt;/STRONG&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Want:&lt;/P&gt;
&lt;P&gt;It should be '&lt;STRONG&gt;SEP2021&lt;/STRONG&gt;'&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 17:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Macro-YYYYMM-to-Dataset-variable-monyy7/m-p/773104#M245540</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-08T17:36:34Z</dc:date>
    </item>
  </channel>
</rss>

