<?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: using Put() to convert format doesn't work in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/617195#M19035</link>
    <description>&lt;P&gt;Thank you.&amp;nbsp; That worked.&amp;nbsp; I saw the Oracle reference, but I didn't realize there was a difference.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jan 2020 13:46:21 GMT</pubDate>
    <dc:creator>dxtran</dc:creator>
    <dc:date>2020-01-14T13:46:21Z</dc:date>
    <item>
      <title>using Put() to convert format doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/616995#M18989</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I tried to use the put() function (as suggested in this forum) to convert a # to text (line 40) and I get an error.&amp;nbsp; Help please.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;29 proc sql ;&lt;BR /&gt;30 connect to odbc(dsn=AMP_DSN uid=Dyyyyyy password = XXXXXXXX!);&lt;/P&gt;&lt;P&gt;31&lt;BR /&gt;32&lt;BR /&gt;33 /* Get Network profile and export results as csv */&lt;BR /&gt;34&lt;BR /&gt;35 create table tbl_NetworkProfile_201612 as&lt;BR /&gt;36 select * from connection to odbc(&lt;BR /&gt;37&lt;BR /&gt;38 select distinct&lt;BR /&gt;39 a.year_month,&lt;BR /&gt;40 put(a.branch_id, 15.) as branch_id,&lt;BR /&gt;41 a.hh_id,&lt;BR /&gt;42 a.customer_segment as Segment,&lt;BR /&gt;43 b.cd_accts as numCD,&lt;BR /&gt;44 b.chk_accts as numChk,&lt;BR /&gt;45 b.heq_accts as numHE,&lt;BR /&gt;46 b.credit_card_accts as numCreditCard,&lt;BR /&gt;47 b.investment_accts as numInvestments,&lt;BR /&gt;48 b.ira_accts as numIRA,&lt;BR /&gt;49 b.mtg_accts as numMortgage,&lt;BR /&gt;50 b.mma_accts as numMMA,&lt;BR /&gt;51 b.sav_accts as numSAV,&lt;BR /&gt;2 The SAS System 12:27 Monday, January 13, 2020&lt;/P&gt;&lt;P&gt;52 c.deposit_avg_bal as depbal,&lt;BR /&gt;53 c.loan_curr_bal as loanbal&lt;BR /&gt;54 from&lt;BR /&gt;55 level2.groupings a, level2.accounts b, level2.balance c&lt;BR /&gt;56 where a.year_month ='201612'&lt;BR /&gt;57 and a.customer_segment &amp;lt;&amp;gt; 'unknown'&lt;BR /&gt;58 and a.year_month = b.year_month&lt;BR /&gt;59 and a.year_month = c.year_month&lt;BR /&gt;60 and a.hh_id = b.hh_id&lt;BR /&gt;61 and a.hh_id = c.hh_id&lt;BR /&gt;62 );&lt;BR /&gt;ERROR: CLI describe error: [Oracle][ODBC][Ora]ORA-00904: "PUT": invalid identifier : [Oracle][ODBC]Invalid descriptor index &amp;lt;1&amp;gt;.&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 18:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/616995#M18989</guid>
      <dc:creator>dxtran</dc:creator>
      <dc:date>2020-01-13T18:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: using Put() to convert format doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/616999#M18993</link>
      <description>&lt;P&gt;That is an error from ORACLE, since you asked Oracle to use the PUT() function.&amp;nbsp; It says that Oracle does not have such a function.&lt;/P&gt;
&lt;P&gt;I think in Oracle you would probably use the TO_CHAR() function, or some other method.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 18:27:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/616999#M18993</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-13T18:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: using Put() to convert format doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/617024#M18995</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/304676"&gt;@dxtran&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should replace&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put(a.branch_id, 15.) as branch_id,&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;by&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;a.branch_id format=15.,&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in your PROC SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, you can also use PROC FEDSQL:&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p0ahxz9t4dkcucn1uiqa42nbazbh.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p0ahxz9t4dkcucn1uiqa42nbazbh.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;DIV class="page" title="Page 181"&gt;
&lt;DIV class="layoutArea"&gt;
&lt;DIV class="column"&gt;
&lt;P&gt;It will allow you not to adapt your SQL native code (e.g. use of the PUT() function to apply a format, etc.).&lt;/P&gt;
&lt;P&gt;You will just need to execute a LIBNAME statement with the ORACLE engine before this procedure.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 13 Jan 2020 19:41:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/617024#M18995</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-01-13T19:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: using Put() to convert format doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/617068#M19001</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;writes your code uses explicit pass-through SQL so you need to use database function to_char() for such a conversion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is nothing in your SQL which SAS couldn't push to the database for execution (except the put() function) so another alternative would be to use implicit pass-through SQL as in the sample code below. The options used below will write to the SAS log which part of the SQL have been pushed to the database for execution.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options sastrace=',,,d' sastraceloc=saslog nostsuffix;
libname level2 odbc dsn=AMP_DSN uid='Dyyyyyy' password = 'XXXXXXXX!';
proc sql;
  /* Get Network profile and export results as csv */
  create table tbl_NetworkProfile_201612 as
    select distinct
      a.year_month,
      put(a.branch_id, 15.) as branch_id,
      a.hh_id,
      a.customer_segment as Segment,
      b.cd_accts as numCD,
      b.chk_accts as numChk,
      b.heq_accts as numHE,
      b.credit_card_accts as numCreditCard,
      b.investment_accts as numInvestments,
      b.ira_accts as numIRA,
      b.mtg_accts as numMortgage,
      b.mma_accts as numMMA,
      b.sav_accts as numSAV,
      c.deposit_avg_bal as depbal,
      c.loan_curr_bal as loanbal
    from
      level2.groupings a, level2.accounts b, level2.balance c
    where a.year_month ='201612'
      and a.customer_segment &amp;lt;&amp;gt; 'unknown'
      and a.year_month = b.year_month
      and a.year_month = c.year_month
      and a.hh_id = b.hh_id
      and a.hh_id = c.hh_id
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also: In case you have also SAS/Access to Oracle licensed, use this engine over ODBC.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 21:38:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/617068#M19001</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-01-13T21:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: using Put() to convert format doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/617195#M19035</link>
      <description>&lt;P&gt;Thank you.&amp;nbsp; That worked.&amp;nbsp; I saw the Oracle reference, but I didn't realize there was a difference.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 13:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/617195#M19035</guid>
      <dc:creator>dxtran</dc:creator>
      <dc:date>2020-01-14T13:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: using Put() to convert format doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/617197#M19036</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp; This is a bit (may be quite a bit) above my level of understanding right now, but I will keep it as reference.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 13:48:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/617197#M19036</guid>
      <dc:creator>dxtran</dc:creator>
      <dc:date>2020-01-14T13:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: using Put() to convert format doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/617198#M19037</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 13:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Put-to-convert-format-doesn-t-work/m-p/617198#M19037</guid>
      <dc:creator>dxtran</dc:creator>
      <dc:date>2020-01-14T13:49:16Z</dc:date>
    </item>
  </channel>
</rss>

