<?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: New SAS User - How do change text field to numeric and using Input function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/New-SAS-User-How-do-change-text-field-to-numeric-and-using-Input/m-p/425829#M104906</link>
    <description>&lt;P&gt;Secondary consideration ... it is a mistake to assign a date format to AGE_IN_DAYS.&amp;nbsp; Just leave it as a numeric field.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any trouble applying the &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt; suggestion, show us what your incoming values for TRANS_DATE look like.&amp;nbsp; That's the key information that would determine whether you need a more specific answer to your question.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jan 2018 17:23:33 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-01-08T17:23:33Z</dc:date>
    <item>
      <title>New SAS User - How do change text field to numeric and using Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-SAS-User-How-do-change-text-field-to-numeric-and-using-Input/m-p/425823#M104903</link>
      <description>&lt;P&gt;Hello community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a beginner SAS user ( version 9.4)&amp;nbsp;and I'm trying to calculate age in days. I'm trying to change a text field to a numeric.&amp;nbsp;Here's the formula that I'm using&amp;nbsp;[ &lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;today() - input(ad.trans_date,&lt;STRONG&gt;&lt;FONT color="#008080"&gt;10.&lt;/FONT&gt;&lt;/STRONG&gt;) &lt;FONT color="#0000ff"&gt;as&lt;/FONT&gt; age_in_days &lt;FONT color="#0000ff"&gt;format&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="2"&gt;yymmdd10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,]The error message says that it's an invalid string and&amp;nbsp;has an invalid argument and missing values may be generated.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;Below is the full code to my process. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Annuity &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AS&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;c.Cust_Uniqe_No &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; TaxIDSSN,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ad.Policy_No,&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;upcase(compbl(trimn(ci.last_name)||&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;', '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;||trimn(ci.first_name)||&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;||trimn(ci.middle_name))) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; customer_name,&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ad.Trans_date,&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;ad.Premium_Amt &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Amount,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;f.Fund_Name &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Product,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;today() - input(ad.trans_date,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;10.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; age_in_days &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="2"&gt;yymmdd10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;upcase(compbl(trimn(ud.Last_Name)||&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;", "&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;||trimn(ud.First_Name))) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; agent_name,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ad.Cancel_Date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;From&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; wealth.Appointment a&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;inner&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;join&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; wealth.Annuity_Detail ad &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;on&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; a.Appnt_ID = ad.Appnt_ID&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;inner&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;join&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; wealth.Customer c &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;on&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; c.Cust_ID = a.Cust_ID&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;inner&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;join&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; wealth.Fund f &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;on&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; f.Fund_ID = ad.Fund_ID&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;inner&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;join&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; wealth.Customer_Individual ci &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;on&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; c.Cust_id = ci.Cust_ID&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;inner&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;join&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; wealth.User_Detail ud &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;on&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ud.Adv_Id = a.Adv_Id&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Where&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (ad.policy_no &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;''&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) or ad.policy_no is &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;null&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Order&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ad.Trans_date;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 17:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-SAS-User-How-do-change-text-field-to-numeric-and-using-Input/m-p/425823#M104903</guid>
      <dc:creator>EW1</dc:creator>
      <dc:date>2018-01-08T17:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: New SAS User - How do change text field to numeric and using Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-SAS-User-How-do-change-text-field-to-numeric-and-using-Input/m-p/425824#M104904</link>
      <description>&lt;P&gt;You&amp;nbsp; need a date informat instead of 10. to convert your char date to numeric date and then do the age computation. Please check the appropriate date informat to apply in the input function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Usually date informats are like mirror of date formats, you would need something like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;input(ad.trans_date,&lt;STRONG&gt;yymmdd10.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Check your char date in your source data thoroughly&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 17:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-SAS-User-How-do-change-text-field-to-numeric-and-using-Input/m-p/425824#M104904</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-08T17:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: New SAS User - How do change text field to numeric and using Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-SAS-User-How-do-change-text-field-to-numeric-and-using-Input/m-p/425829#M104906</link>
      <description>&lt;P&gt;Secondary consideration ... it is a mistake to assign a date format to AGE_IN_DAYS.&amp;nbsp; Just leave it as a numeric field.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any trouble applying the &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt; suggestion, show us what your incoming values for TRANS_DATE look like.&amp;nbsp; That's the key information that would determine whether you need a more specific answer to your question.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 17:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-SAS-User-How-do-change-text-field-to-numeric-and-using-Input/m-p/425829#M104906</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-01-08T17:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: New SAS User - How do change text field to numeric and using Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-SAS-User-How-do-change-text-field-to-numeric-and-using-Input/m-p/425832#M104907</link>
      <description>thank you so much for your advice.. it works for me..</description>
      <pubDate>Mon, 08 Jan 2018 17:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-SAS-User-How-do-change-text-field-to-numeric-and-using-Input/m-p/425832#M104907</guid>
      <dc:creator>EW1</dc:creator>
      <dc:date>2018-01-08T17:29:17Z</dc:date>
    </item>
  </channel>
</rss>

