<?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 error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/931126#M366330</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;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; i just noticed for one of the visit one subject only have date in LBDTC (2023-02-22) while all others are date and time (2023-03-27T12:10)&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So what do you want to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the variable is character you test the length and branch you code as to what to do. The question(s) you have to answer:&lt;/P&gt;
&lt;P&gt;Is this to be considered a valid date value?&lt;/P&gt;
&lt;P&gt;If so, since you need a date time, what time do&amp;nbsp; you want to be associated with observations like this.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2024 13:39:37 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-06-06T13:39:37Z</dc:date>
    <item>
      <title>INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928526#M365318</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting this error message for INPUT function, could anyone please help me with this issue? TIA.&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;data lb;&lt;BR /&gt;merge adsl(in=a) lb1(in=b);&lt;BR /&gt;length AVALC $50. SUBJID $15.;&lt;BR /&gt;by USUBJID;&lt;BR /&gt;if a and b;&lt;BR /&gt;INDEX+1;&lt;BR /&gt;SUBJID=substr(USUBJID,13,7);&lt;BR /&gt;AVAL=LBSTRESN;&lt;BR /&gt;AVALC=LBSTRESC;&lt;BR /&gt;if LBCAT='COAGULATION' and LBTESTCD in ('APTT' 'INR' 'PT')&lt;BR /&gt;or LBCAT='URINALYSIS' and LBTESTCD in ('URBILV' 'URGLUV' 'URPHV' 'URPROTV' 'URSGV');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=lb1(where=(index(TRT01A,'Placebo')&amp;gt;0 and LBDTC^='')) out=lb_1(where=(input(LBDTC,e8601dt16.)&amp;lt;=TRTSDTM));&lt;BR /&gt;by INDEX;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting ERROR: INPUT function reported 'ERROR: Invalid date value' while processing WHERE clause.&lt;/P&gt;&lt;P&gt;LBDTC is character 2023-11-07T12:50&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 18:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928526#M365318</guid>
      <dc:creator>billi_billi</dc:creator>
      <dc:date>2024-05-15T18:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928530#M365321</link>
      <description>&lt;P&gt;I cannot reproduce this error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please, for this problem and for all future problems, when there are errors in the log, show us the ENTIRE log for the PROC or DATA step that has the errors. Copying the error statement detached from the code shown in the log is rarely helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please copy the log as text and paste 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-1663012019648.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75161i0E71B1489A6C9839/image-size/large?v=v2&amp;amp;px=999" role="button" title="PaigeMiller_0-1663012019648.png" alt="PaigeMiller_0-1663012019648.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please, when your code isn't working, provide small example data sets that we can work from. Provide the data sets as working SAS data step code (&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;examples and instructions&lt;/A&gt;) and in no other format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 18:30:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928530#M365321</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-05-15T18:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928544#M365326</link>
      <description>&lt;P&gt;If somehow that variable has one or more leading spaces you would get that error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I would have transformed that variable to a datetime value way before this step.&lt;/P&gt;
&lt;P&gt;See if this removes the error message:&lt;/P&gt;
&lt;PRE&gt;proc sort data=lb1(where=(index(TRT01A,'Placebo')&amp;gt;0 and LBDTC^=''))
 out=lb_1(where=(input( strip(LBDTC) ,e8601dt16.)&amp;lt;=TRTSDTM));
by INDEX;&lt;/PRE&gt;
&lt;P&gt;If that doesn't generate an error then likely there are leading spaces and that should be fixed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why did you bother to include that code for data lb? Your problem is with the Sort of Data=lb1.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 19:17:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928544#M365326</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-15T19:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928556#M365338</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;I am still getting same error.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 21:18:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928556#M365338</guid>
      <dc:creator>billi_billi</dc:creator>
      <dc:date>2024-05-15T21:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928562#M365344</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;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;I am still getting same error.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Create a new data set and create a new variable with the datetime value using the input function.&lt;/P&gt;
&lt;P&gt;If you get the error then there should be more details in the log to show that should help. Then copy the log with the INVALID data lines and paste the log into a text box opened on the forum with the &amp;lt;/&amp;gt; icon that appears above the message window.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test_lb1;
   set lb1;
  dt_lbdtc=  input(LBDTC,e8601dt16.);
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 21:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928562#M365344</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-15T21:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928579#M365355</link>
      <description>&lt;P&gt;You could run below version of your Proc Sort code to investigate which source strings are causing the observed error.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort nodupkey
  data=lb1(keep=index TRT01A LBDTC TRTSDTM where=(index(TRT01A,'Placebo')&amp;gt;0 and LBDTC^='')) 
  out=INVESTIGATE(where=(missing(input(LBDTC,? e8601dt16.)) and not missing(LBDTC)));
  by LBDTC;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Using the ? as part of the input() function will avoid the error condition.&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 01:39:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928579#M365355</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-16T01:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928601#M365362</link>
      <description>&lt;P&gt;Do you have values of that variable that contain just a single period?&lt;/P&gt;
&lt;P&gt;That is what you will get if you used the PUT() function to generate the string and the MISSING option was set to a period.&lt;/P&gt;
&lt;PRE&gt;323     do now=datetime(),.;
324       LBDTC=put(now,e8601dt16.);
325       now2 = input(LBDTC,e8601dt16.);
326       format LBDTC $quote. now: e8601dt16. ;
327       put (_all_) (=);
328     end;
329   run;

now=2024-05-16T00:14 LBDTC="2024-05-16T00:14" now2=2024-05-16T00:14
NOTE: Invalid argument to function INPUT at line 325 column 12.
now=. LBDTC="               ." now2=.
now=. LBDTC="               ." now2=. _ERROR_=1 _N_=1
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).
      1 at 325:12
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 04:15:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/928601#M365362</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-05-16T04:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/931112#M366327</link>
      <description>&lt;P&gt;I used this code and for one subject LBDTC does not have time and date is in this format 2023-02-22 while for all other subjects LBDTC is in this format 2023-03-27T12:10&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 12:36:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/931112#M366327</guid>
      <dc:creator>billi_billi</dc:creator>
      <dc:date>2024-06-06T12:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/931113#M366328</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; i just noticed for one of the visit one subject only have date in LBDTC (2023-02-22) while all others are date and time (2023-03-27T12:10)</description>
      <pubDate>Thu, 06 Jun 2024 12:40:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/931113#M366328</guid>
      <dc:creator>billi_billi</dc:creator>
      <dc:date>2024-06-06T12:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/931126#M366330</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;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; i just noticed for one of the visit one subject only have date in LBDTC (2023-02-22) while all others are date and time (2023-03-27T12:10)&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So what do you want to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the variable is character you test the length and branch you code as to what to do. The question(s) you have to answer:&lt;/P&gt;
&lt;P&gt;Is this to be considered a valid date value?&lt;/P&gt;
&lt;P&gt;If so, since you need a date time, what time do&amp;nbsp; you want to be associated with observations like this.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 13:39:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/931126#M366330</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-06-06T13:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/931139#M366334</link>
      <description>&lt;P&gt;Do you care about the time of day?&amp;nbsp; If not then use DATE values instead of DATETIME values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=lb1(where=(index(TRT01A,'Placebo')&amp;gt;0 and LBDTC^='')) 
  out=lb_1(where=(input(LBDTC,yymmdd10.)&amp;lt;=datepart(TRTSDTM)))
;
  by INDEX;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you do then provide a default time of day.&amp;nbsp; Perhaps midnight?&amp;nbsp; You might be able to just append it to the existing value.&amp;nbsp; If the value had the full 16 bytes the appended text will be ignored because the informat specification only looks at the first 16 bytes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=lb1(where=(index(TRT01A,'Placebo')&amp;gt;0 and LBDTC^=''))
  out=lb_1(where=(input(cats(LBDTC,'T00:00'),e8601dt16.)&amp;lt;=TRTSDTM))
;
  by INDEX;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Jun 2024 14:09:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/931139#M366334</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-06-06T14:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: INPUT function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/931167#M366347</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; thank you very much for your help this worked. I used midnight and append it to the value.</description>
      <pubDate>Thu, 06 Jun 2024 16:46:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INPUT-function-error/m-p/931167#M366347</guid>
      <dc:creator>billi_billi</dc:creator>
      <dc:date>2024-06-06T16:46:53Z</dc:date>
    </item>
  </channel>
</rss>

