<?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: add a numeric zero to the month extracted in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/add-a-numeric-zero-to-the-month-extracted/m-p/646318#M193313</link>
    <description>&lt;P&gt;I think that you didn't delve deep enough into INFORMATs for dates.&lt;/P&gt;
&lt;P&gt;Your example string is appropriate to read with ddmmyy10. informat.&lt;/P&gt;
&lt;PRE&gt;data example;
  x='21/07/2015';
  y = input(x,ddmmyy10.);
  format y yymmdd10.;
run;&lt;/PRE&gt;
&lt;P&gt;If the DDMMYY10 informat does not work then provide 1) actual examples of the data and 2) the code you used with the informat.&lt;/P&gt;
&lt;P&gt;You can not use something, such as the example above of:&amp;nbsp; x = input(x,ddyymm10.); because once a variable is defined as character you cannot change it to numeric. (Just in case that is why you thing it won't work)&lt;/P&gt;</description>
    <pubDate>Fri, 08 May 2020 22:02:37 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-05-08T22:02:37Z</dc:date>
    <item>
      <title>add a numeric zero to the month extracted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-numeric-zero-to-the-month-extracted/m-p/646315#M193311</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;
&lt;P&gt;I have a variable admitdt with a format $CHAR10. and displays value 21/07/2015.&lt;/P&gt;
&lt;P&gt;I need to convert it in to YYMMDD10. format for which i have separated in to month date year separately and later using MDY function to join them as they cann't be converted directly to numeric by input function.&lt;/P&gt;
&lt;P&gt;I'm using these formats to separate theall the 3 components out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;dt=input(substr(admitdt,1,2),best.); month =input(substr(admitdt,4,2),best2.);&lt;/P&gt;
&lt;P&gt;year=input(substr(admitdt,7,4),best.);&amp;nbsp; addt=mdy(dt,month,year);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The month data which is giving 7 after conversion for which i have tried using z2. informat by which it throws error by saying z2. informat is not found or loaded and gives blank to my surprise .&lt;/P&gt;
&lt;P&gt;If there is a other way out, kindly help me out with some suggestion.&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 21:56:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-numeric-zero-to-the-month-extracted/m-p/646315#M193311</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2020-05-08T21:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: add a numeric zero to the month extracted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-numeric-zero-to-the-month-extracted/m-p/646318#M193313</link>
      <description>&lt;P&gt;I think that you didn't delve deep enough into INFORMATs for dates.&lt;/P&gt;
&lt;P&gt;Your example string is appropriate to read with ddmmyy10. informat.&lt;/P&gt;
&lt;PRE&gt;data example;
  x='21/07/2015';
  y = input(x,ddmmyy10.);
  format y yymmdd10.;
run;&lt;/PRE&gt;
&lt;P&gt;If the DDMMYY10 informat does not work then provide 1) actual examples of the data and 2) the code you used with the informat.&lt;/P&gt;
&lt;P&gt;You can not use something, such as the example above of:&amp;nbsp; x = input(x,ddyymm10.); because once a variable is defined as character you cannot change it to numeric. (Just in case that is why you thing it won't work)&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 22:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-numeric-zero-to-the-month-extracted/m-p/646318#M193313</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-08T22:02:37Z</dc:date>
    </item>
  </channel>
</rss>

