BookmarkSubscribeRSS Feed
Dreamer
Obsidian | Level 7

Hi,

Same SQL table field shows different data types in SAS PC & EG.

I ran same PROC CONTENTS in PC & EG environment and here is the output. Check for DATADATE field:

PROC CONTENTS DATA=DB_NAME.TABLE_NAME;RUN;


SAS PC output:

PC.JPG


SAS EG output:

EG.JPG 

Actual SQL table definition:

SQL.JPG

 

Because of this data type mismatch I'm not able to append data to this table from SAS PC.

WARNING: Variable DataDate not appended because of type mismatch.

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

Show us the libname statements creating library DB_NAME for both environments (EG and proper SAS).

Dreamer
Obsidian | Level 7

Hi @ChrisNZ,

I have same library statement in both environment:

 

libname DB_NAME odbc dsn='PC_ODBC_DSN_FOR_THIS_DATABASE' uid= "&UID." pwd="&PWD." schema="dbo";

libname DB_NAME odbc dsn='UNIX_ODBC_DSN_FOR_THIS_DATABASE' uid= "&UID." pwd="&PWD." schema="dbo";

ChrisNZ
Tourmaline | Level 20

It looks like the ODBC driver differs in both environments.

 

SAS will use whatever ODBC gives it. You can use another ODBC client to confirm this.

 

 

You can use the cat() or vvalue() function to avoid reading errors when the type is uncertain:

 

data T1; D='01jan2016'd; format D date9.; run;

data WANT1; set T1; DATE=input(vvalue(D),date9.); run;

data T2; D='01jan2016'; run;

data WANT2; set T2; DATE=input(vvalue(D),date9.); run; 

 

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