<?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 Using EG 4.2 - how to extract 1st 3 digits from numeric column? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14398#M2945</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Changed to format $8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Error generated in SAS EG:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;19 (SUBSTR(PUT(t1.ACCOUNT_ID, $8.),1,3)&lt;/P&gt;&lt;P&gt;20 ) LENGTH=3 AS TP_ADDR_ACCTID_3&lt;/P&gt;&lt;P&gt;21 FROM ORACLDS.ADDRESS AS t1&lt;/P&gt;&lt;P&gt;22 WHERE t1.SOURCE_ID = 5 AND t1.HISTORY_FLAG = 'N'&lt;/P&gt;&lt;P&gt;23 ORDER BY t1.ENTITY_ID, t1.ADDRESS_ID;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR: Character format $ in PUT function requires a character argument.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR: Character format $ in PUT function requires a character argument.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Dec 2011 21:27:57 GMT</pubDate>
    <dc:creator>ncsthbell</dc:creator>
    <dc:date>2011-12-14T21:27:57Z</dc:date>
    <item>
      <title>Using EG 4.2 - how to extract 1st 3 digits from numeric column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14394#M2941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a numeric column "ACCTID" defined as length 16, example value &lt;STRONG&gt;350&lt;/STRONG&gt;8777719876543.&amp;nbsp; I want to extract the 1st 3 digits from the value and create a new column with it's contents.&amp;nbsp; I have created a computed column named "ACCTID_3" using the following advanced expression: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;(SUBSTR(PUT(t1.ACCTID, BEST.),1,3)) and my result is 3.5&amp;nbsp; (the result I want is 350) ((I don't care if the result is numeric or character)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;In the advanced edit window, on page 2 of 3 titled "Modify Additional Options", the column type is defined as numeric, with 'none' for the format. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;I have changed this to column type 'character' and it does not like it.&amp;nbsp; Can you please tell me what I am doing wrong?&amp;nbsp; Any help would be greatly appreciated!!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2011 19:02:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14394#M2941</guid>
      <dc:creator>ncsthbell</dc:creator>
      <dc:date>2011-12-14T19:02:29Z</dc:date>
    </item>
    <item>
      <title>Using EG 4.2 - how to extract 1st 3 digits from numeric column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14395#M2942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this instead:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(SUBSTR(PUT(t1.ACCTID, &lt;STRONG&gt;8.&lt;/STRONG&gt;),1,3))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and set the format to $8. or make it a character.&amp;nbsp; A character value will not insert the decimal point.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;IMG alt="000_EG_get_prefix.png" class="jive-image-thumbnail jive-image" onclick="" src="https://communities.sas.com/legacyfs/online/1338_000_EG_get_prefix.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tricia&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.bi-notes.com"&gt;SAS BI Notes&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2011 19:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14395#M2942</guid>
      <dc:creator>TriciaA</dc:creator>
      <dc:date>2011-12-14T19:52:30Z</dc:date>
    </item>
    <item>
      <title>Using EG 4.2 - how to extract 1st 3 digits from numeric column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14396#M2943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I am using SAS EG 4.2, our screens are a bit different so we must not be on the same release.&amp;nbsp; I am still getting the decimal. No matter what I change the column format to, it makes it numeric.&amp;nbsp; &lt;/P&gt;&lt;P&gt;On the 2nd screen "Modify additional properties", I give the column &amp;amp; alias name and under 'column type' there are radio buttons for either Character or Numeric.&amp;nbsp; I am chosing 'character'.&amp;nbsp;&amp;nbsp; On the 3rd screen, it still interprets it as numeric.&amp;nbsp; When I hit the 'back' key and return to the 2nd screen, the radio button that I had set to 'character' has gone back to 'numeric.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Here is the code generated (on 3rd screen)&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Alias: TP_NAME_ACCTID_3&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Column: TP_NAME_ACCTID_3&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Type: &lt;STRONG&gt;Numeric&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;=== shows as numeric even when I set the column type to character&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Format: None&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Length: Default&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Summary: None&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Expression: &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; (SUBSTR(PUT(t1.ACCOUNT_ID, 8.),1,3))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;My result is still coming as 3.5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was going to send screen shots and couldn't figure out how to copy &amp;amp; paste them in the body of this as you did above.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can accomplish this in Oracle Sql but I am new to SAS and I just can't get it to work!&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Times New Roman','serif';"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2011 20:38:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14396#M2943</guid>
      <dc:creator>ncsthbell</dc:creator>
      <dc:date>2011-12-14T20:38:15Z</dc:date>
    </item>
    <item>
      <title>Using EG 4.2 - how to extract 1st 3 digits from numeric column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14397#M2944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try setting the format to $8. to force the character. Mine would only do it when I added the format.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2011 20:53:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14397#M2944</guid>
      <dc:creator>TriciaA</dc:creator>
      <dc:date>2011-12-14T20:53:22Z</dc:date>
    </item>
    <item>
      <title>Using EG 4.2 - how to extract 1st 3 digits from numeric column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14398#M2945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Changed to format $8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Error generated in SAS EG:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;19 (SUBSTR(PUT(t1.ACCOUNT_ID, $8.),1,3)&lt;/P&gt;&lt;P&gt;20 ) LENGTH=3 AS TP_ADDR_ACCTID_3&lt;/P&gt;&lt;P&gt;21 FROM ORACLDS.ADDRESS AS t1&lt;/P&gt;&lt;P&gt;22 WHERE t1.SOURCE_ID = 5 AND t1.HISTORY_FLAG = 'N'&lt;/P&gt;&lt;P&gt;23 ORDER BY t1.ENTITY_ID, t1.ADDRESS_ID;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR: Character format $ in PUT function requires a character argument.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR: Character format $ in PUT function requires a character argument.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2011 21:27:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14398#M2945</guid>
      <dc:creator>ncsthbell</dc:creator>
      <dc:date>2011-12-14T21:27:57Z</dc:date>
    </item>
    <item>
      <title>Using EG 4.2 - how to extract 1st 3 digits from numeric column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14399#M2946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry ... I meant force it for the output on the screen where it asked if you want Character or Numeric.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Select Character and set the format to $8.&amp;nbsp; Setting the format should be enough.&lt;/P&gt;&lt;P&gt;You don't have to set the length -leave it blank.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change your original calculation back to this:SUBSTR(PUT(t1.ACCOUNT_ID, &lt;STRONG&gt;8.&lt;/STRONG&gt;),1,3)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2011 21:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-EG-4-2-how-to-extract-1st-3-digits-from-numeric-column/m-p/14399#M2946</guid>
      <dc:creator>TriciaA</dc:creator>
      <dc:date>2011-12-14T21:38:28Z</dc:date>
    </item>
  </channel>
</rss>

