BookmarkSubscribeRSS Feed
Erockanderson
Calcite | Level 5

Hello.  I pulling data from a cache database.  Upon execution of the query the field I need is being truncated to 80 characters.  I have tried setting the length, informat, and format on the pull but no success.  Code is below.  I would appreciate any suggestions on how to have it read in the full value.  I have tried the pull with other SQL tools and can pull the full value with no setting or options added.  

 

libname k odbc dsn=Kaiser1 schema=SqLUSeR readbuff=10000;

 

proc sql;
create table calls1a as
select t1.Name_Of_VTrak_File informat $2000. format $2000. length=2000 as Name_Of_VTrak_Filez
from k.call_logging_audit(dbkey=Date_Call_Began) t1
where Date_Call_Began = &start. and Recorded_Voicetrak=1;
quit;

3 REPLIES 3
koyelghosh
Lapis Lazuli | Level 10

Similar issue has been discussed here (https://communities.sas.com/t5/SAS-Procedures/character-length-in-proc-sql-versus-data-step/td-p/259...).

 

Did you try using DATA step. If DATA step is working, then the ODBC is not truncating anything before passing it to SAS. Otherwise may be it is your ODBC settings that is truncating the value to 80 characters before it reaches SAS for processing. This is my guess. 

Erockanderson
Calcite | Level 5
I get the same results when running as a data step. 80 characters. How
would I go about seeing if the odbc settings are limiting the length. This
field in particular was lengthened recently due to an upgrade of the
system. Does SAS store database characteristics it could be defaulting to
somewhere?
koyelghosh
Lapis Lazuli | Level 10

Not sure if this will run as I don't have access to your database (to test it out) but worth a try. Replace ABC, DEF and GHI, below, appropriately. 

 

proc sql;
connect to odbc as mycon
   (datasrc=ABC user=DEF password=GHI);

select *
   from connection to mycon
      (Your Raw SQL query here);

disconnect from mycon;
quit;  

 Try some simple query like fetching a column which has more than 80 characters in its contents

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2812 views
  • 0 likes
  • 2 in conversation