<?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: informat to read year month date values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493757#M129957</link>
    <description>hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;, thank you for covering for all possible situations,&lt;BR /&gt;yes, I am reading date values from a sas dataset in character form</description>
    <pubDate>Sat, 08 Sep 2018 15:11:43 GMT</pubDate>
    <dc:creator>s_manoj</dc:creator>
    <dc:date>2018-09-08T15:11:43Z</dc:date>
    <item>
      <title>informat to read year month date values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493750#M129950</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; One quick question, in my data I have date values in YYYYMM format, how to read those values to display&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;YYYY-MM format;&lt;/P&gt;&lt;P&gt;here my values in raw data:&lt;/P&gt;&lt;P&gt;201809&lt;/P&gt;&lt;P&gt;200001&lt;/P&gt;&lt;P&gt;200205&lt;/P&gt;&lt;P&gt;201106&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;expecting output:&lt;/P&gt;&lt;P&gt;2018-09&lt;/P&gt;&lt;P&gt;2000-01&lt;/P&gt;&lt;P&gt;2002-05&lt;/P&gt;&lt;P&gt;2011-06&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;-manoj&lt;/P&gt;</description>
      <pubDate>Sat, 08 Sep 2018 13:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493750#M129950</guid>
      <dc:creator>s_manoj</dc:creator>
      <dc:date>2018-09-08T13:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: informat to read year month date values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493751#M129951</link>
      <description>&lt;P&gt;format YYMMD. should give you the display you are asking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Sep 2018 14:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493751#M129951</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-09-08T14:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: informat to read year month date values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493752#M129952</link>
      <description>&lt;P&gt;The answer depends on some of the information that you omitted, so there are a few variations.&amp;nbsp; You will only need one of these solutions, depending on whether you are reading from raw data (vs. you already have a SAS data set), and depending on whether your existing variable is character or numeric.&amp;nbsp; (If you had supplied this information, you wouldn't need to read through all the parts of the answer that you don't need.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are reading those values originally from raw data, you can do it this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input dtvar yymmddn6.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Only then can you print DTVAR using the yymmd7. format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you already have these values in a SAS data set, are they stored as numeric or as character?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If numeric, create a new variable in your desired format using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length newvar $ 7;&lt;/P&gt;
&lt;P&gt;newvar = put(dtvar, z6.);&lt;/P&gt;
&lt;P&gt;newvar = put(input(newvar, yymmn6.), yymmd7.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If character, create a new variable in your desired format using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;newvar = put(input(dtvar, yymmn6.), yymmd7.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Sep 2018 14:35:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493752#M129952</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-09-08T14:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: informat to read year month date values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493753#M129953</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/183918"&gt;@s_manoj&lt;/a&gt;&amp;nbsp; "&lt;SPAN&gt;how to&lt;EM&gt;&lt;STRONG&gt; read those values&lt;/STRONG&gt;&lt;/EM&gt; to display&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;YYYY-MM format;"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What are the date values or can those date values revert back to &lt;STRONG&gt;first&lt;/STRONG&gt; of the month?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Sep 2018 14:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493753#M129953</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-08T14:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: informat to read year month date values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493757#M129957</link>
      <description>hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;, thank you for covering for all possible situations,&lt;BR /&gt;yes, I am reading date values from a sas dataset in character form</description>
      <pubDate>Sat, 08 Sep 2018 15:11:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493757#M129957</guid>
      <dc:creator>s_manoj</dc:creator>
      <dc:date>2018-09-08T15:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: informat to read year month date values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493758#M129958</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&lt;BR /&gt;yes, can revert back to first of month</description>
      <pubDate>Sat, 08 Sep 2018 15:12:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493758#M129958</guid>
      <dc:creator>s_manoj</dc:creator>
      <dc:date>2018-09-08T15:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: informat to read year month date values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493759#M129959</link>
      <description>&lt;P&gt;Ok although answered,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/*Reading with yymmn6. will revert to 1st of the month*/
data have;
input dt : yymmn6.;
format dt yymmd.;*format with yymmd.;
cards;
201809
200001
200205
201106
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 08 Sep 2018 15:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493759#M129959</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-08T15:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: informat to read year month date values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493760#M129960</link>
      <description>Thank you</description>
      <pubDate>Sat, 08 Sep 2018 15:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493760#M129960</guid>
      <dc:creator>s_manoj</dc:creator>
      <dc:date>2018-09-08T15:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: informat to read year month date values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493761#M129961</link>
      <description>How to read , if we want to display with last day of month?</description>
      <pubDate>Sat, 08 Sep 2018 15:24:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493761#M129961</guid>
      <dc:creator>s_manoj</dc:creator>
      <dc:date>2018-09-08T15:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: informat to read year month date values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493762#M129962</link>
      <description>&lt;P&gt;Good question. I'm afraid I am not aware if there's a way to read directly to revert to last day of the month. But &lt;STRONG&gt;Intnx&lt;/STRONG&gt; is always handy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Reading with yymmn6. will revert to 1st of the month*/
data have;
input dt : yymmn6.;
dt=intnx('month',dt,0,'e');
format dt yymmd.;*format with yymmd.;
cards;
201809
200001
200205
201106
;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Sep 2018 15:28:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493762#M129962</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-08T15:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: informat to read year month date values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493766#M129966</link>
      <description>Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&lt;BR /&gt;its informative</description>
      <pubDate>Sat, 08 Sep 2018 15:35:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/informat-to-read-year-month-date-values/m-p/493766#M129966</guid>
      <dc:creator>s_manoj</dc:creator>
      <dc:date>2018-09-08T15:35:10Z</dc:date>
    </item>
  </channel>
</rss>

