<?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 partial date to numeric date year and month in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-partial-date-to-numeric-date-year-and-month/m-p/953080#M372432</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I am converting the character date to numeric, but only year and month values are not populating , i am using below code but getting error as "yymmd.) format not find.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="raja777pharma_1-1733816916370.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102865iB048C60438DBE1DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="raja777pharma_1-1733816916370.png" alt="raja777pharma_1-1733816916370.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="raja777pharma_0-1733816746956.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102864i37518BDE3167D48F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="raja777pharma_0-1733816746956.png" alt="raja777pharma_0-1733816746956.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can any one suggest how to populate only year and month values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Raja.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Dec 2024 07:49:12 GMT</pubDate>
    <dc:creator>raja777pharma</dc:creator>
    <dc:date>2024-12-10T07:49:12Z</dc:date>
    <item>
      <title>Convert partial date to numeric date year and month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-partial-date-to-numeric-date-year-and-month/m-p/953080#M372432</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I am converting the character date to numeric, but only year and month values are not populating , i am using below code but getting error as "yymmd.) format not find.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="raja777pharma_1-1733816916370.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102865iB048C60438DBE1DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="raja777pharma_1-1733816916370.png" alt="raja777pharma_1-1733816916370.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="raja777pharma_0-1733816746956.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102864i37518BDE3167D48F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="raja777pharma_0-1733816746956.png" alt="raja777pharma_0-1733816746956.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can any one suggest how to populate only year and month values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Raja.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 07:49:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-partial-date-to-numeric-date-year-and-month/m-p/953080#M372432</guid>
      <dc:creator>raja777pharma</dc:creator>
      <dc:date>2024-12-10T07:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Convert partial date to numeric date year and month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-partial-date-to-numeric-date-year-and-month/m-p/953081#M372433</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;PRE&gt;data have;
input x $20.;
y=input(x,&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;anydtdte32.&lt;/STRONG&gt;&lt;/FONT&gt;);
format y yymmdd10.;
cards;
2020-10-10
2022-08
;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1733817930928.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102866i3CE5DEB8D035D35B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1733817930928.png" alt="Ksharp_0-1733817930928.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 08:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-partial-date-to-numeric-date-year-and-month/m-p/953081#M372433</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-12-10T08:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Convert partial date to numeric date year and month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-partial-date-to-numeric-date-year-and-month/m-p/953091#M372438</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/309000"&gt;@raja777pharma&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can any one suggest how to populate only year and month values.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You want to take the first 7 characters of dtc_ and ignore the rest. You will also need to remove the hyphen from these dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dtc1_=compress(substr(dtc_,1,7),'-');
dt=input(dtc1_,yymmn6.);
format dt yymm6.; /* or any other format you want */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no informat YYMMD which is why you get the error. There is an informat YYMMDD (with two Ds on the end), but that won't work on the data in DTC_ that you show.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might want to talk to whomever provides you with dates as character strings that this is not a good thing to do. Or if you converted the dates to character strings earlier in the program, don't do that. Keep dates as numeric variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do not provide the log as a screen capture. Please provide the log by copying it as text and then pasting it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1715196634946.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96351i414DE7EE2D1B5DE6/image-size/large?v=v2&amp;amp;px=999" role="button" title="PaigeMiller_0-1715196634946.png" alt="PaigeMiller_0-1715196634946.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 13:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-partial-date-to-numeric-date-year-and-month/m-p/953091#M372438</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-12-10T13:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Convert partial date to numeric date year and month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-partial-date-to-numeric-date-year-and-month/m-p/953095#M372440</link>
      <description>You must create a day for such partial values. So you need a rule for that which makes sense in your business context, e.g. the first, the last, or the 15th of the month. Once you have the rule, you can put it in code.</description>
      <pubDate>Tue, 10 Dec 2024 12:50:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-partial-date-to-numeric-date-year-and-month/m-p/953095#M372440</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-12-10T12:50:13Z</dc:date>
    </item>
  </channel>
</rss>

