<?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: Passing char date variables list and impute the date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Passing-char-date-variables-list-and-impute-the-date/m-p/878179#M346955</link>
    <description>&lt;P&gt;Your're right, it's a bit hard to follow you... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But if you could provide with a relevant input data it might becomes more clear. That in a for of a data step with DATALINES.&lt;/P&gt;</description>
    <pubDate>Tue, 30 May 2023 09:21:54 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2023-05-30T09:21:54Z</dc:date>
    <item>
      <title>Passing char date variables list and impute the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-char-date-variables-list-and-impute-the-date/m-p/878170#M346953</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I have deleted my earlier message content as I feel that it's not very clear and also received a response that it's not clear. Can anyone share sample code for date imputations where the input to a macro is a list of char type date variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 11:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-char-date-variables-list-and-impute-the-date/m-p/878170#M346953</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-05-30T11:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Passing char date variables list and impute the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-char-date-variables-list-and-impute-the-date/m-p/878179#M346955</link>
      <description>&lt;P&gt;Your're right, it's a bit hard to follow you... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But if you could provide with a relevant input data it might becomes more clear. That in a for of a data step with DATALINES.&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 09:21:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-char-date-variables-list-and-impute-the-date/m-p/878179#M346955</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-05-30T09:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Passing char date variables list and impute the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-char-date-variables-list-and-impute-the-date/m-p/878193#M346957</link>
      <description>&lt;P&gt;Thank you for the reply. Since, I feel that it's not very clear, I will delete this post.&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 10:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-char-date-variables-list-and-impute-the-date/m-p/878193#M346957</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-05-30T10:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Passing char date variables list and impute the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-char-date-variables-list-and-impute-the-date/m-p/878201#M346959</link>
      <description>&lt;P&gt;I've seen your initial post which was an example of "over-macrotized".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to start with a single static example just using a SAS data step and make this work for all the different date patterns you're dealing with.&lt;/P&gt;
&lt;P&gt;Only then try to make your code dynamic.&lt;/P&gt;
&lt;P&gt;From how I understand your problem there shouldn't be a need for much macro logic at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could start with a simple data step as below until you get it right for all the possible date strings you're dealing with.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  infile datalines truncover;
  input date_string $20.;
  format dt date9.;
  
  /* try-catch with multiple informats */
  dt=input(date_string,?? date9.);
  if missing(dt) then dt=input(date_string,?? yymmdd10.);
  if missing(dt) then dt=input(date_string,?? ddmmyy10.);
  /* more formats as required to cover all the possible date strings */
  datalines;
10Jan2023
10-Feb
20231015
15102023
15-10-2023
;

proc print data=test;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 12:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-char-date-variables-list-and-impute-the-date/m-p/878201#M346959</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-05-30T12:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Passing char date variables list and impute the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-char-date-variables-list-and-impute-the-date/m-p/878254#M346980</link>
      <description>&lt;P&gt;Thank you very much for the example. Yes, I will explore it further.&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 16:55:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-char-date-variables-list-and-impute-the-date/m-p/878254#M346980</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-05-30T16:55:55Z</dc:date>
    </item>
  </channel>
</rss>

