<?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: Converting char into numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/743935#M233004</link>
    <description>WHERE input(PatientIdentityID, best.) IN (SELECT mrn FROM ed.all_mrn)</description>
    <pubDate>Wed, 26 May 2021 16:01:50 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-05-26T16:01:50Z</dc:date>
    <item>
      <title>Converting char into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/743929#M233001</link>
      <description>&lt;P&gt;Hello all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I received this error when trying to run this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;35         PROC SQL;
36         CREATE TABLE work.chemo AS
37         SELECT
38         	CASE WHEN Month(input(DischargeDTS,yymmdd10.)) &amp;gt; 9
39         		THEN YEAR(input(DischargeDTS,yymmdd10.)) + 1
40         		ELSE YEAR(input(DischargeDTS,yymmdd10.))
41         	END AS fiscal_year
42         , I.PatientIdentityID as MRN
43         , DischargeDTS AS date
44         , HospitalAccountID
45         FROM epicfin.HospitalAccount a
46         LEFT JOIN EPICPAT.Identity I on a.PatientID = I.PatientID
47         WHERE PatientIdentityID IN (SELECT mrn FROM ed.all_mrn)
48         ;
ERROR: Expression using IN has components that are of different data types.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I checked the tables and see that PatientIdentityID is char but ed.all_mrn is numeric. How do I convert the&amp;nbsp;PatientIdentityID into numeric so that this code runs? Any help wold be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 15:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/743929#M233001</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2021-05-26T15:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Converting char into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/743933#M233003</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE input(PatientIdentityID,16.) IN (SELECT mrn FROM ed.all_mrn)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You may or may not need to use 16 digits for PatientIdentityID, but if there are fewer digits, feel free to modify the code above.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 16:01:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/743933#M233003</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-26T16:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Converting char into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/743935#M233004</link>
      <description>WHERE input(PatientIdentityID, best.) IN (SELECT mrn FROM ed.all_mrn)</description>
      <pubDate>Wed, 26 May 2021 16:01:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/743935#M233004</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-05-26T16:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Converting char into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/743936#M233005</link>
      <description>&lt;P&gt;Matching numbers is easier since character strings might have different numbers of leading zeros or leading spaces.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE input(PatientIdentityID,32.) IN (SELECT mrn FROM ed.all_mrn)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hopefully you do not have ids with significant leading zeros, or more than 15 digits.&amp;nbsp; If so the values in the mrn variable in the ed.all_mrn dataset are probably already wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 16:03:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/743936#M233005</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-26T16:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Converting char into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/744037#M233033</link>
      <description>&lt;P&gt;Thanks PaigeMiller. That worked perfectly.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 20:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/744037#M233033</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2021-05-26T20:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Converting char into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/744038#M233034</link>
      <description>Thanks Reeza...that worked perfect. Rather than use a particular length I used best and it was perfect.</description>
      <pubDate>Wed, 26 May 2021 20:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/744038#M233034</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2021-05-26T20:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Converting char into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/744039#M233035</link>
      <description>&lt;P&gt;Thanks Tom, as I told the others this worked perfectly. Is there a way to accept everyone's response as a solution. I want to give credit to you all.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 20:35:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/744039#M233035</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2021-05-26T20:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Converting char into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/744052#M233041</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/114971"&gt;@wheddingsjr&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks Reeza...that worked perfect. Rather than use a particular length I used best and it was perfect.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note that &lt;STRONG&gt;BEST&lt;/STRONG&gt; is the name of a FORMAT.&amp;nbsp; If you use it as in INFORMAT you will just get the normal &lt;STRONG&gt;w.d&lt;/STRONG&gt; informat instead of any "best" informat.&amp;nbsp; &amp;nbsp;Just use &lt;STRONG&gt;32.&lt;/STRONG&gt; as the informat.&amp;nbsp; 32 is the maximum number of bytes that informat supports and the INPUT() function does not care if the width used on the informat is more bytes than there are in the string being read.&amp;nbsp; So unless there are trailing characters in the string you do not want to read there is no reason to use something shorter.&amp;nbsp; Do NOT add a decimal place value to the informat unless you &lt;STRONG&gt;know&lt;/STRONG&gt; that the decimal was &lt;STRONG&gt;purposely&lt;/STRONG&gt; excluded from the string and you want to automatically divide any values without an explicit decimal point by the corresponding power of ten in order to place the missing decimal point in the right place.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 21:48:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-char-into-numeric/m-p/744052#M233041</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-26T21:48:40Z</dc:date>
    </item>
  </channel>
</rss>

