BookmarkSubscribeRSS Feed
KiranMaddi
Obsidian | Level 7

Hello Friends,

 

SAS 9.3

EG 5.1

SQL Server 2014

Windows 7

 

 

I am stuck with an issue when pulling the data from SQL through an ODBC connection. I am using the below code.

 

proc sql;
connect to odbc (&connectA);
create table test as
select * from
connection to odbc
(select * from [DB - Production].pri.test) ;
disconnect from odbc;
quit;

When I run the code it gives me the above error. When I investigated it there is a column in SQL that SAS doesn't like which is 'ABCDE' in (time(0), null) format. The rest of the columns are coming along fine.

 

What I should I do to pull this column along with others without erroring?

 

Thanks in advance for your help.

3 REPLIES 3
LinusH
Tourmaline | Level 20

I see nothing in your query that calls for an explicit pass-thru.

Use a libname connection instead. If you still got problems, IMHO is that it's easier to trouble shoot.

Data never sleeps
KiranMaddi
Obsidian | Level 7
Hi LinusH

Tried libname which imported the complete table. But unable to open it on SAS.
Getting the same above error.
LinusH
Tourmaline | Level 20
With a libname add
Options msglevel = I sastrace =',,,d' SASTRACELOC = saslog nostsuffix;
That will tell you what's going on in the RDBMS.
Also check the contents in the numerical columns, perhaps you have integers that are larger than Sas can handle. If this is the case you may need to cast the column to char before importing to Sas.
Data never sleeps

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3327 views
  • 0 likes
  • 2 in conversation