<?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 and more, again in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Input-function-and-more-again/m-p/517833#M3434</link>
    <description>&lt;P&gt;Maybe you’re in the same class?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/URGENT-HELP-PLEASE/m-p/517749" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/URGENT-HELP-PLEASE/m-p/517749&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247190"&gt;@IGK22&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello, I don't have any ideas how to decide this problem, therefore I don't have any codes and log. So.&lt;/P&gt;
&lt;P&gt;I have a variable, lets name it &lt;STRONG&gt;"s_raw"&lt;/STRONG&gt;. It contains character values, most of them are just dates with &lt;STRONG&gt;date9.&lt;/STRONG&gt; format.&lt;/P&gt;
&lt;P&gt;But there is also values contains letter &lt;STRONG&gt;'U' (for example "UUUU202")&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;What I need to do, is to create new numeric variable&amp;nbsp;&lt;STRONG&gt;"w_raw"&amp;nbsp;&lt;/STRONG&gt;containing all &lt;STRONG&gt;date9.&lt;/STRONG&gt; value format as numbers, and&amp;nbsp;If the first character is&amp;nbsp;&lt;STRONG&gt;“U”&lt;/STRONG&gt;, leave the numeric Value missing.&lt;/P&gt;
&lt;P&gt;I need to do this in one data step. Please, help me&amp;nbsp;&lt;img id="catfrustrated" class="emoticon emoticon-catfrustrated" src="https://communities.sas.com/i/smilies/16x16_cat-frustrated.png" alt="Cat Frustrated" title="Cat Frustrated" /&gt;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 02 Dec 2018 07:16:32 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-12-02T07:16:32Z</dc:date>
    <item>
      <title>Input function and more, again</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-and-more-again/m-p/517818#M3426</link>
      <description>&lt;P&gt;Hello, I don't have any ideas how to decide this problem, therefore I don't have any codes and log. So.&lt;/P&gt;&lt;P&gt;I have a variable, lets name it &lt;STRONG&gt;"s_raw"&lt;/STRONG&gt;. It contains character values, most of them are just dates with &lt;STRONG&gt;date9.&lt;/STRONG&gt; format.&lt;/P&gt;&lt;P&gt;But there is also values contains letter &lt;STRONG&gt;'U' (for example "UUUU202")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;What I need to do, is to create new numeric variable&amp;nbsp;&lt;STRONG&gt;"w_raw"&amp;nbsp;&lt;/STRONG&gt;containing all &lt;STRONG&gt;date9.&lt;/STRONG&gt; value format as numbers, and&amp;nbsp;If the first character is&amp;nbsp;&lt;STRONG&gt;“U”&lt;/STRONG&gt;, leave the numeric Value missing.&lt;/P&gt;&lt;P&gt;I need to do this in one data step. Please, help me&amp;nbsp;&lt;img id="catfrustrated" class="emoticon emoticon-catfrustrated" src="https://communities.sas.com/i/smilies/16x16_cat-frustrated.png" alt="Cat Frustrated" title="Cat Frustrated" /&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Dec 2018 06:16:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-and-more-again/m-p/517818#M3426</guid>
      <dc:creator>IGK22</dc:creator>
      <dc:date>2018-12-02T06:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Input function and more, again</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-and-more-again/m-p/517824#M3429</link>
      <description>&lt;P&gt;Just use the INPUT() function with the DATE9. informat specification.&lt;/P&gt;
&lt;P&gt;What about the values that don't start with the letter U but are also not valid date strings?&lt;/P&gt;
&lt;P&gt;What other value could you set them to than missing?.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to suppress errors messages prefix the informat with a question mark.&amp;nbsp; You can use two question marks in a data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;w_raw = input(s_raw,??date9.);
format w_raw date9. ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Dec 2018 06:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-and-more-again/m-p/517824#M3429</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-12-02T06:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Input function and more, again</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-and-more-again/m-p/517826#M3431</link>
      <description>Well, there is no other values except date9. format and all others are UUUU*random numbers*.&lt;BR /&gt;Unfortunately, I can't suppress errors, and if I do input function, I get dots(.) all over the variable&lt;BR /&gt;</description>
      <pubDate>Sun, 02 Dec 2018 06:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-and-more-again/m-p/517826#M3431</guid>
      <dc:creator>IGK22</dc:creator>
      <dc:date>2018-12-02T06:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Input function and more, again</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-and-more-again/m-p/517833#M3434</link>
      <description>&lt;P&gt;Maybe you’re in the same class?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/URGENT-HELP-PLEASE/m-p/517749" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/URGENT-HELP-PLEASE/m-p/517749&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247190"&gt;@IGK22&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello, I don't have any ideas how to decide this problem, therefore I don't have any codes and log. So.&lt;/P&gt;
&lt;P&gt;I have a variable, lets name it &lt;STRONG&gt;"s_raw"&lt;/STRONG&gt;. It contains character values, most of them are just dates with &lt;STRONG&gt;date9.&lt;/STRONG&gt; format.&lt;/P&gt;
&lt;P&gt;But there is also values contains letter &lt;STRONG&gt;'U' (for example "UUUU202")&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;What I need to do, is to create new numeric variable&amp;nbsp;&lt;STRONG&gt;"w_raw"&amp;nbsp;&lt;/STRONG&gt;containing all &lt;STRONG&gt;date9.&lt;/STRONG&gt; value format as numbers, and&amp;nbsp;If the first character is&amp;nbsp;&lt;STRONG&gt;“U”&lt;/STRONG&gt;, leave the numeric Value missing.&lt;/P&gt;
&lt;P&gt;I need to do this in one data step. Please, help me&amp;nbsp;&lt;img id="catfrustrated" class="emoticon emoticon-catfrustrated" src="https://communities.sas.com/i/smilies/16x16_cat-frustrated.png" alt="Cat Frustrated" title="Cat Frustrated" /&gt;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Dec 2018 07:16:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-and-more-again/m-p/517833#M3434</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-02T07:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Input function and more, again</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-and-more-again/m-p/517870#M3440</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247190"&gt;@IGK22&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Well, there is no other values except date9. format and all others are UUUU*random numbers*.&lt;BR /&gt;Unfortunately, I can't suppress errors, and if I do input function, I get dots(.) all over the variable&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The question mark will suppress the errors in the log.&amp;nbsp; A single period is the default way that SAS will print a missing numeric value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you saying that NONE of the values are getting converted to valid dates?&amp;nbsp; Are you sure that the text in the character variable is actual in a format that is valid for the DATE informat?&amp;nbsp; Do the values have hyphens or other punctuation between the day month and year parts?&amp;nbsp; Make the width you use on the informat is long enough for the longest valid date string.&amp;nbsp; Does it have leading spaces?&amp;nbsp; Does it contain tabs or other invisible characters?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;97   data test;
98     input char $32.;
99     num1=input(char,date9.);
100    num2=input(char,??date9.);
101    format num1 num2 date9.;
102  cards;

NOTE: Invalid argument to function INPUT at line 99 column 8.
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
103        UUU123
char=UUU123 num1=. num2=. _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 99:8
NOTE: The data set WORK.TEST has 3 observations and 3 variables.&lt;/PRE&gt;
&lt;P&gt;Notice how the error message on occurs for the INPUT() function that did not have the ?? before the format specification.&lt;/P&gt;
&lt;P&gt;Also notice that reading only 9 characters from the first date string made it assume that the 20 represented the year within the century.&lt;/P&gt;
&lt;PRE&gt;Obs    char                num1         num2

 1     UUU123                 .            .
 2     01-JAN-2018    01JAN1920    01JAN1920
 3     01jan18        01JAN2018    01JAN2018&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Dec 2018 16:26:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-and-more-again/m-p/517870#M3440</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-12-02T16:26:26Z</dc:date>
    </item>
  </channel>
</rss>

