<?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: Help with INPUT function error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-with-INPUT-function-error/m-p/917698#M361491</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260153"&gt;@billi_billi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;In the error it gave me the second date variable.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="billi_billi_0-1708734408315.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94062iC6A769998C7837A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="billi_billi_0-1708734408315.png" alt="billi_billi_0-1708734408315.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That looks NOTHING like the type of string that the DATE informat can read.&lt;/P&gt;
&lt;P&gt;What INFORMAT should you use?&lt;/P&gt;
&lt;LI-SPOILER&gt;That is something you would need to use YYMMDD10. informat to read.&lt;/LI-SPOILER&gt;</description>
    <pubDate>Sat, 24 Feb 2024 00:45:49 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-02-24T00:45:49Z</dc:date>
    <item>
      <title>Help with INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-INPUT-function-error/m-p/917693#M361487</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two dates and I need to calculate difference between them, but both the date variables are character variables, so I used INPUT function to convert it to numeric but I am getting error message 'Invalid argument to function INPUT at line'. Below is my code, can anyone please help me with this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;proc sql;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;create table baseline as&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;select 1 as order,usubjid, VISIT, VESTDTC, VESTDY&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; from ve&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; where VISIT = 'Baseline';&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; quit;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;proc sql;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;create table visits as&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; select 1 as order, usubjid, VISIT, VESTDTC,VESTDY&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; from ve&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; where VISIT = 'Visit 2';&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;quit;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;proc sort data=baseline (rename=(VESTDTC=baseline_date));&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; by USUBJID;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;proc sort data=visits;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; by USUBJID;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;RUN;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;data combined;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; merge baseline visits;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;by usubjid;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;data change;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; set combined;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;numBase_date=INPUT(baseline_date,date9.);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; format numBase_date date9.;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2024 00:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-INPUT-function-error/m-p/917693#M361487</guid>
      <dc:creator>billi_billi</dc:creator>
      <dc:date>2024-02-24T00:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Help with INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-INPUT-function-error/m-p/917694#M361488</link>
      <description>&lt;P&gt;SAS should have shown you the actual values of BASELINE_DATE that caused the issue.&lt;/P&gt;
&lt;P&gt;Let's make some example strings and see what happens.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input string $char20.;
  date = input(string,date9.);
  format string $quote. date date9.;
cards;
01JAN2024
1jan24
1-jan-2024
    01JAN2024
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the LOG&lt;/P&gt;
&lt;PRE&gt;1    data test;
2      input string $char20.;
3      date = input(string,date9.);
4      format string $quote. date date9.;
5    cards;

NOTE: Invalid argument to function INPUT at line 3 column 10.
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
8          1-jan-2024
string="1-jan-2024" date=. _ERROR_=1 _N_=3
NOTE: Invalid argument to function INPUT at line 3 column 10.
9              01JAN2024
string="    01JAN2024" date=. _ERROR_=1 _N_=4
NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to
      missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      2 at 3:10
NOTE: The data set WORK.TEST has 4 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


10   ;
&lt;/PRE&gt;
&lt;P&gt;Can you tell why it did not like lines 9 and 10?&lt;/P&gt;
&lt;P&gt;Can you think of a way to fix the code so they work?&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;11   data test;
12     input string $char20.;
13     date = input(left(string),date11.);
14     format string $quote. date date9.;
15   cards;

NOTE: The data set WORK.TEST has 4 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


20   ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2024 00:12:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-INPUT-function-error/m-p/917694#M361488</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-24T00:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help with INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-INPUT-function-error/m-p/917696#M361489</link>
      <description>&lt;P&gt;In the error it gave me the second date variable.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="billi_billi_0-1708734408315.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94062iC6A769998C7837A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="billi_billi_0-1708734408315.png" alt="billi_billi_0-1708734408315.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2024 00:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-INPUT-function-error/m-p/917696#M361489</guid>
      <dc:creator>billi_billi</dc:creator>
      <dc:date>2024-02-24T00:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help with INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-INPUT-function-error/m-p/917698#M361491</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260153"&gt;@billi_billi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;In the error it gave me the second date variable.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="billi_billi_0-1708734408315.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94062iC6A769998C7837A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="billi_billi_0-1708734408315.png" alt="billi_billi_0-1708734408315.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That looks NOTHING like the type of string that the DATE informat can read.&lt;/P&gt;
&lt;P&gt;What INFORMAT should you use?&lt;/P&gt;
&lt;LI-SPOILER&gt;That is something you would need to use YYMMDD10. informat to read.&lt;/LI-SPOILER&gt;</description>
      <pubDate>Sat, 24 Feb 2024 00:45:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-INPUT-function-error/m-p/917698#M361491</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-24T00:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help with INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-INPUT-function-error/m-p/917700#M361493</link>
      <description>&lt;P&gt;thank you so much for your help. It worked.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2024 01:04:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-INPUT-function-error/m-p/917700#M361493</guid>
      <dc:creator>billi_billi</dc:creator>
      <dc:date>2024-02-24T01:04:27Z</dc:date>
    </item>
  </channel>
</rss>

