<?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 Format for getting YYYYMM in numeric in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Format-for-getting-YYYYMM-in-numeric/m-p/741455#M29138</link>
    <description>&lt;P&gt;dear SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have numeric variables for YEAR (ex: 2021) and MONTH (ex: 5) and I want to get a new variable like: YYYYMM in NUMERIC, where the month Always on 2 Digits is ; for instance: 202105.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I get this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in Advance,&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;PY&lt;/P&gt;</description>
    <pubDate>Fri, 14 May 2021 14:18:06 GMT</pubDate>
    <dc:creator>PierreYvesILY</dc:creator>
    <dc:date>2021-05-14T14:18:06Z</dc:date>
    <item>
      <title>Format for getting YYYYMM in numeric</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Format-for-getting-YYYYMM-in-numeric/m-p/741455#M29138</link>
      <description>&lt;P&gt;dear SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have numeric variables for YEAR (ex: 2021) and MONTH (ex: 5) and I want to get a new variable like: YYYYMM in NUMERIC, where the month Always on 2 Digits is ; for instance: 202105.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I get this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in Advance,&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;PY&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 14:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Format-for-getting-YYYYMM-in-numeric/m-p/741455#M29138</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2021-05-14T14:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Format for getting YYYYMM in numeric</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Format-for-getting-YYYYMM-in-numeric/m-p/741456#M29139</link>
      <description>&lt;P&gt;So you want a numeric variable that contains YYYYMM in which case this will do it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input month  year ;
datalines;
05 2021
04 2020
03 2019
;

data want ;
	set have;
	want=year*100+month ;
	put year= month= want= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Although I would recommend you convert your numeric month/year into a SAS Date value and then format that, as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input month  year ;
datalines;
05 2021
04 2020
03 2019
;

data want ;
	set have;
	sasDate=mdy(month,01,year) ;
	want=putn(sasDate,"yymmn6.") ;
	put year= month= sasDate= want= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 May 2021 14:32:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Format-for-getting-YYYYMM-in-numeric/m-p/741456#M29139</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2021-05-14T14:32:41Z</dc:date>
    </item>
  </channel>
</rss>

