<?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: Input function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Input-function/m-p/879726#M347547</link>
    <description>&lt;P&gt;Ok.&amp;nbsp; I just realized that some record in&amp;nbsp;EXSTDTC has partial dates like (2012/01, 2009. Majority of the data are complete. Thank you sir.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Jun 2023 10:40:42 GMT</pubDate>
    <dc:creator>PrinceAde</dc:creator>
    <dc:date>2023-06-08T10:40:42Z</dc:date>
    <item>
      <title>Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-function/m-p/879721#M347542</link>
      <description>&lt;P&gt;data ex2;&lt;BR /&gt;set ex1;&lt;BR /&gt;first_id = first.usubjid;&lt;BR /&gt;last_id = last.usubjid;&lt;BR /&gt;*line 256;if first_id ne 0 then TRTSDT=input(EXSTDTC, yymmdd10.);&lt;BR /&gt;*line 257;if last_id = 1 then TRTEDT=input(EXENDTC, yymmdd10.);&lt;BR /&gt;format TRTSDT TRTEDT date9.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;LOG;&lt;/P&gt;&lt;P&gt;NOTE: Invalid argument to function INPUT at line 257 column 28.&lt;BR /&gt;USUBJID=CYT001302-3901-12855 ACTARM=CYT001 10 MG EXSTDTC=2008-10-10 EXENDTC=2012-01 FIRST_ID=1&lt;BR /&gt;LAST_ID=1 ACTARMCD=CYT0 TRT01A=CYT001 10 MG TRTSDT=10OCT2008 TRTEDT=. _ERROR_=1 _N_=269&lt;BR /&gt;NOTE: Invalid argument to function INPUT at line 257 column 28&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Line 256 works just fine. Please what could be the problem in line 257?&lt;/P&gt;&lt;P&gt;Please kindly help to resolve this error&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 10:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-function/m-p/879721#M347542</guid>
      <dc:creator>PrinceAde</dc:creator>
      <dc:date>2023-06-08T10:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-function/m-p/879723#M347544</link>
      <description>&lt;P&gt;"2012-01" is not a valid date for the YYMMDD informat. You must supply a day component also.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 10:05:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-function/m-p/879723#M347544</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-08T10:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-function/m-p/879724#M347545</link>
      <description>&lt;PRE&gt;USUBJID=CYT001302-3901-12855 ACTARM=CYT001 10 MG EXSTDTC=2008-10-10 &lt;FONT color="#FF0000"&gt;EXENDTC=2012-01&lt;/FONT&gt; FIRST_ID=1
LAST_ID=1 ACTARMCD=CYT0 TRT01A=CYT001 10 MG TRTSDT=10OCT2008 TRTEDT=. _ERROR_=1 _N_=269&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot read the value 2012-01 with the informat yymmdd10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxim 3&lt;/A&gt;: Know Your Data&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 10:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-function/m-p/879724#M347545</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-08T10:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-function/m-p/879726#M347547</link>
      <description>&lt;P&gt;Ok.&amp;nbsp; I just realized that some record in&amp;nbsp;EXSTDTC has partial dates like (2012/01, 2009. Majority of the data are complete. Thank you sir.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 10:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-function/m-p/879726#M347547</guid>
      <dc:creator>PrinceAde</dc:creator>
      <dc:date>2023-06-08T10:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-function/m-p/879775#M347566</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/440493"&gt;@PrinceAde&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Ok.&amp;nbsp; I just realized that some record in&amp;nbsp;EXSTDTC has partial dates like (2012/01, 2009. Majority of the data are complete. Thank you sir.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If these are pretty consistent patterns as to the value you could test the length of the EXSTDTC variable and conditionally use different input calls. This approach will impute values for day of month or day and month based on provided values.&lt;/P&gt;
&lt;PRE&gt;data example;
  input Exendtc :$10.;
  last_id =1;

   if last_id =1 then select (length(Exendtc));
      when (8,9,10) TRTEDT=input(EXENDTC, yymmdd10.);
      when (7)      TRTEDT=input(catx('/',EXENDTC,'01'), yymmdd10.);
      when (6)      TRTEDT=input(EXENDTC, yymmn6.);
      when (4)      TRTEDT=input(cats(EXENDTC,'01'), yymmn6.);
      otherwise ;
   end;
   format TRTEDT date9.;
datalines;
20201115
2020/11/15
2020/07
202003
2020
;&lt;/PRE&gt;
&lt;P&gt;If you want to impute a different day of the month or month replace the '01' with the day or month preferred. Note that the YYMMN informat will impute the day of the month to be 1.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 14:56:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-function/m-p/879775#M347566</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-06-08T14:56:36Z</dc:date>
    </item>
  </channel>
</rss>

