<?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: How to Convert yyyymmdd(numeric) to DATE9 format? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523445#M4621</link>
    <description>&lt;P&gt;Apparently you are querying on the column which is having the sas date value internally , with a formatted values of year and month. Check this&amp;nbsp; modified query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 
%let runasofdate = 20181001;

options mprint mlogic symbolgen;

%put &amp;amp;runasofdate.;

data PARTY_PROF;
input tran_month yymmn6.;
format tran_month yymmn6.;
cards;
201810
201811
201710
run;

data x;
dt = symget ('runasofdate');
rndt = cats("'",dt,"'");
call symput ('rndt',rndt);
mnth = substr(dt,1,6);
call symput('m_key',strip(mnth));
run;


%put &amp;amp;m_key.;
 

data _test;
set PARTY_PROF;
where put(tran_month,yymmn6.)="&amp;amp;m_key.";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 24 Dec 2018 23:07:22 GMT</pubDate>
    <dc:creator>r_behata</dc:creator>
    <dc:date>2018-12-24T23:07:22Z</dc:date>
    <item>
      <title>How to Convert yyyymmdd(numeric) to DATE9 format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/521483#M4204</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly help me in converting YYYYMMDD (numeric) into date9. format or YYMMn6.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;20181201&lt;/STRONG&gt;-&amp;gt; which is in numeric format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ashok Arunachalam&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>Fri, 14 Dec 2018 14:56:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/521483#M4204</guid>
      <dc:creator>Ashok3395</dc:creator>
      <dc:date>2018-12-14T14:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to Convert yyyymmdd(numeric) to DATE9 format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/521485#M4205</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input dt ;
format dt9 date9.;
dt9=input(put(dt,8.),yymmdd8.);

cards;
20181201
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Dec 2018 15:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/521485#M4205</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2018-12-14T15:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Convert yyyymmdd(numeric) to DATE9 format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/521489#M4206</link>
      <description>&lt;P&gt;Alternatively try the anydtdte. informat to read the dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input date: anydtdte.;
format date date9.;
cards;
20181201
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Dec 2018 15:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/521489#M4206</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2018-12-14T15:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to Convert yyyymmdd(numeric) to DATE9 format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523396#M4607</link>
      <description>&lt;P&gt;Hi Jag,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the update!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is my scenario,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having the table&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Trans_month(column)&amp;nbsp;&lt;/STRONG&gt;which is in date format (yymmn6.)--&amp;gt; ex :201810.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And im trying to run the below code/logic to&amp;nbsp; extract the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let runasofdate = 20181001;&lt;/P&gt;&lt;P&gt;options mprint mlogic symbolgen;&lt;/P&gt;&lt;P&gt;%put &amp;amp;runasofdate.;&lt;/P&gt;&lt;P&gt;data x;&lt;BR /&gt;dt = symget ('runasofdate');&lt;BR /&gt;rndt = cats("'",dt,"'");&lt;BR /&gt;call symput ('rndt',rndt);&lt;BR /&gt;mnth = substr(dt,1,6);&lt;BR /&gt;call symput('m_key',strip(mnth));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _test;&lt;BR /&gt;set PARTY_PROF;&lt;BR /&gt;where tran_month=&amp;amp;&lt;SPAN&gt;m_key.&lt;/SPAN&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while running the above code im getting nil records ,even though im having the data in the main table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ashok Arunachalam&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Dec 2018 13:36:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523396#M4607</guid>
      <dc:creator>Ashok3395</dc:creator>
      <dc:date>2018-12-24T13:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to Convert yyyymmdd(numeric) to DATE9 format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523397#M4608</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the update!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is my scenario,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having the table&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Trans_month(column)&amp;nbsp;&lt;/STRONG&gt;which is in date format (yymmn6.)--&amp;gt; ex :201810.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And im trying to run the below code/logic to&amp;nbsp; extract the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let runasofdate = 20181001;&lt;/P&gt;&lt;P&gt;options mprint mlogic symbolgen;&lt;/P&gt;&lt;P&gt;%put &amp;amp;runasofdate.;&lt;/P&gt;&lt;P&gt;data x;&lt;BR /&gt;dt = symget ('runasofdate');&lt;BR /&gt;rndt = cats("'",dt,"'");&lt;BR /&gt;call symput ('rndt',rndt);&lt;BR /&gt;mnth = substr(dt,1,6);&lt;BR /&gt;call symput('m_key',strip(mnth));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _test;&lt;BR /&gt;set PARTY_PROF;&lt;BR /&gt;where tran_month=&amp;amp;&lt;SPAN&gt;m_key.&lt;/SPAN&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while running the above code im getting nil records ,even though im having the data in the main table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ashok Arunachalam&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Dec 2018 13:37:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523397#M4608</guid>
      <dc:creator>Ashok3395</dc:creator>
      <dc:date>2018-12-24T13:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to Convert yyyymmdd(numeric) to DATE9 format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523445#M4621</link>
      <description>&lt;P&gt;Apparently you are querying on the column which is having the sas date value internally , with a formatted values of year and month. Check this&amp;nbsp; modified query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 
%let runasofdate = 20181001;

options mprint mlogic symbolgen;

%put &amp;amp;runasofdate.;

data PARTY_PROF;
input tran_month yymmn6.;
format tran_month yymmn6.;
cards;
201810
201811
201710
run;

data x;
dt = symget ('runasofdate');
rndt = cats("'",dt,"'");
call symput ('rndt',rndt);
mnth = substr(dt,1,6);
call symput('m_key',strip(mnth));
run;


%put &amp;amp;m_key.;
 

data _test;
set PARTY_PROF;
where put(tran_month,yymmn6.)="&amp;amp;m_key.";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Dec 2018 23:07:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523445#M4621</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2018-12-24T23:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to Convert yyyymmdd(numeric) to DATE9 format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523502#M4636</link>
      <description>&lt;P&gt;we could simplify the program as below by using the %substr instead of call symput and a data step&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let m_key = %substr(20181001,1,6);
%put &amp;amp;m_key.;
options nomprint nomlogic nosymbolgen;
data _test;
set &lt;SPAN&gt;PARTY_PROF;&lt;/SPAN&gt;
where date=&lt;SPAN&gt;&amp;amp;m_key.&lt;/SPAN&gt;;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Dec 2018 19:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523502#M4636</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2018-12-25T19:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to Convert yyyymmdd(numeric) to DATE9 format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523530#M4638</link>
      <description>Thank you Jagadish.&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Dec 2018 08:17:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523530#M4638</guid>
      <dc:creator>Ashok3395</dc:creator>
      <dc:date>2018-12-26T08:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to Convert yyyymmdd(numeric) to DATE9 format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523531#M4639</link>
      <description>&lt;P&gt;Thank you ...its working&lt;/P&gt;</description>
      <pubDate>Wed, 26 Dec 2018 08:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-Convert-yyyymmdd-numeric-to-DATE9-format/m-p/523531#M4639</guid>
      <dc:creator>Ashok3395</dc:creator>
      <dc:date>2018-12-26T08:18:01Z</dc:date>
    </item>
  </channel>
</rss>

