<?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: Setting Field Attribute Length on Data Returned From Oracle Using Proc SQL in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Setting-Field-Attribute-Length-on-Data-Returned-From-Oracle/m-p/75833#M22013</link>
    <description>Simply use Oracle's substr() function:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
connect to odbc(user=xxx password=xxx datasrc=Oracle);&lt;BR /&gt;
create view rollup_vw as select * from connection to odbc&lt;BR /&gt;
(SELECT T1.YEAR,&lt;BR /&gt;
T1.Code,&lt;BR /&gt;
substr(T1.DESCRIPTION,1,4) as DESCRIPTION&lt;BR /&gt;
FROM MIDF.Organization T1&lt;BR /&gt;
quit;</description>
    <pubDate>Wed, 21 Apr 2010 00:44:16 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2010-04-21T00:44:16Z</dc:date>
    <item>
      <title>Setting Field Attribute Length on Data Returned From Oracle Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-Field-Attribute-Length-on-Data-Returned-From-Oracle/m-p/75832#M22012</link>
      <description>How do I set a field attribute length using proc sql when I am using a pass through query to return data from Oracle.&lt;BR /&gt;
&lt;BR /&gt;
Example SQL Code&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  connect to odbc(user=xxx password=xxx datasrc=Oracle);&lt;BR /&gt;
  create view rollup_vw as select * from connection to odbc&lt;BR /&gt;
  	(SELECT T1.YEAR,&lt;BR /&gt;
       T1.Code,&lt;BR /&gt;
       T1.DESCRIPTION&lt;BR /&gt;
       FROM MIDF.Organization T1&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
The field code comes in as character with a length of 100 and I need to make it character with a length of 4.  Currently using a data step with an attribute statment to change the length but it throws a warning about data loss and I need to either surpress the warning and associated warning codes or correct the data length in the proc sql.  Any help would be greatly appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Many Thanks</description>
      <pubDate>Tue, 20 Apr 2010 22:12:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-Field-Attribute-Length-on-Data-Returned-From-Oracle/m-p/75832#M22012</guid>
      <dc:creator>JDMTX</dc:creator>
      <dc:date>2010-04-20T22:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Field Attribute Length on Data Returned From Oracle Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-Field-Attribute-Length-on-Data-Returned-From-Oracle/m-p/75833#M22013</link>
      <description>Simply use Oracle's substr() function:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
connect to odbc(user=xxx password=xxx datasrc=Oracle);&lt;BR /&gt;
create view rollup_vw as select * from connection to odbc&lt;BR /&gt;
(SELECT T1.YEAR,&lt;BR /&gt;
T1.Code,&lt;BR /&gt;
substr(T1.DESCRIPTION,1,4) as DESCRIPTION&lt;BR /&gt;
FROM MIDF.Organization T1&lt;BR /&gt;
quit;</description>
      <pubDate>Wed, 21 Apr 2010 00:44:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-Field-Attribute-Length-on-Data-Returned-From-Oracle/m-p/75833#M22013</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-04-21T00:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Field Attribute Length on Data Returned From Oracle Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-Field-Attribute-Length-on-Data-Returned-From-Oracle/m-p/75834#M22014</link>
      <description>We tried to substr (...1,100) and ended up with lengths of 300 in the view.&lt;BR /&gt;
Has this ever happened to you?</description>
      <pubDate>Wed, 21 Apr 2010 18:23:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-Field-Attribute-Length-on-Data-Returned-From-Oracle/m-p/75834#M22014</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-21T18:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Field Attribute Length on Data Returned From Oracle Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-Field-Attribute-Length-on-Data-Returned-From-Oracle/m-p/75835#M22015</link>
      <description>Try this:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
connect to odbc(user=xxx password=xxx datasrc=Oracle);&lt;BR /&gt;
create view rollup_vw as select &lt;BR /&gt;
year length = 4&lt;BR /&gt;
,code&lt;BR /&gt;
,description &lt;BR /&gt;
from connection to odbc&lt;BR /&gt;
(SELECT T1.YEAR,&lt;BR /&gt;
T1.Code,&lt;BR /&gt;
T1.DESCRIPTION&lt;BR /&gt;
FROM MIDF.Organization T1&lt;BR /&gt;
quit;</description>
      <pubDate>Wed, 21 Apr 2010 23:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-Field-Attribute-Length-on-Data-Returned-From-Oracle/m-p/75835#M22015</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2010-04-21T23:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Field Attribute Length on Data Returned From Oracle Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-Field-Attribute-Length-on-Data-Returned-From-Oracle/m-p/75836#M22016</link>
      <description>Of course the LENGTH= and/or FORMAT= parameters can be coded for individual SAS variables/columns in the SELECT.  For SAS CHARACTER variables, remember to include the leading $ character, as in LENGTH=$4 . &lt;BR /&gt;
&lt;BR /&gt;
Otherwise, the coding technique from the OP with "SELECT * " will not support any LENGTH= or FORMAT=, unless variables are listed explicitly.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 22 Apr 2010 01:17:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-Field-Attribute-Length-on-Data-Returned-From-Oracle/m-p/75836#M22016</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-04-22T01:17:06Z</dc:date>
    </item>
  </channel>
</rss>

