DATA Step, Macro, Functions and more

Truncated Characters when extracting

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

Truncated Characters when extracting

Hello,

 

I am trying to extract information from Oracle database using the following command:

 

proc sql;

connect to odbc as hindsight (datasrc='PostgreSQL30' user=xxxxx password="xxxx");

create table value04  as

select * from connection to hindsight

(SELECT fact_event.fact_id,fact_event.region_cd,fact_event.transaction_dte,fact_event.roll_num,

fact_event.property_cd,fact_event.property_desc,fact_event.cty_mun,value_dim.value_rounded, comp_dim.value_component_id,

comp_dim.transaction_dte, comp_dim.unadjusted, comp_dim.value, comp_dim.valuation_type, comp_dim.priority,

comp_dim.property_adjusted, comp_dim.component_adjusted, comp_dim.component_id, comp_dim.building_id_number,

comp_dim.variables, comp_dim.active

FROM hindsight_3.fact_event fact_event

INNER JOIN

(SELECT roll_num, max(transaction_dte) as max_transaction_dte

FROM hindsight_3.fact_event fact_event

WHERE fact_event.event_type='CMV' and fact_event.status_cd='A'

GROUP BY roll_num) transaction_dte on fact_event.roll_num=transaction_dte.roll_num and fact_event.transaction_dte=transaction_dte.max_transaction_dte

LEFT JOIN hindsight_3.property_dim property_dim ON fact_event.fact_id = property_dim.fact_id

LEFT JOIN hindsight_3.value_component_dim comp_dim ON fact_event.fact_id = comp_dim.fact_id

LEFT JOIN hindsight_3.value_dim value_dim ON fact_event.fact_id = value_dim.fact_id

WHERE ((substring(fact_event.region_cd,1,1) = '0' and substring(fact_event.region_cd,2,1) = '04') or fact_event.region_cd = '04')

and fact_event.event_type='CMV' and fact_event.status_cd='A' and property_dim.status_cd='A'

ORDER BY fact_event.roll_num);

quit;

run;

 

When I checked the "variables" column the data length is set to 1024 characters only whereas the original length of the variable is 65535.

 

Can you please let me know how to extract the complete "variables" column?

 

Thank you,

 

Ave

 


Accepted Solutions
Solution
‎07-04-2017 10:14 AM
Regular Contributor
Posts: 228

Re: Truncated Characters when extracting

Posted in reply to AJDELACRUZ0220

All Replies
Solution
‎07-04-2017 10:14 AM
Regular Contributor
Posts: 228

Re: Truncated Characters when extracting

Posted in reply to AJDELACRUZ0220
Occasional Contributor
Posts: 6

Re: Truncated Characters when extracting

this perfectly worked! thank you so much!!!


wong wrote:

try dbmax_text= in your proc sql

Using SAS® to Manage and Report Long Text Fields in a Clinical DBMS


 

Super User
Posts: 7,863

Re: Truncated Characters when extracting

Posted in reply to AJDELACRUZ0220

First of all, you won't be able to conserve the whole length, because the maximum length for a SAS character variable is 32767.

So it's either that SAS sees that the variable is too long and sets 1024 on it's own, or it might be that ODBC itself or the Oracle ODBC driver has a 1024 character limit.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 141 views
  • 1 like
  • 3 in conversation