Hi All,
I'm trying to write to a postgres database and I am getting the following error:
ERROR: CLI execute error: ERROR: invalid byte sequence for encoding "UTF8": 0x81; Error while executing the query.
I've added the PRESERVE_COL_NAMES options to my libname statement as well as the dquote option to my proc sql statement and I'm still getting the error.
Please help suggest other options to use.
I've included the proc sql code I used as well as the error message received.
Thank you for all your help.
proc sql dquote=ansi;
create table pg_rep.activation_Rate_base as
select *
from Factor_Base;
quit;
Check your SAS session encoding using PROC OPTIONS:
proc options option = encoding;
run;
If it is different to UTF8 then this could be the cause of your error.
The encoding of the SAS session is UTF-8.
What is the definition of the pg_rep libref?
Is it using SAS base engine?
Some external database?
It is an external database, PostgresSQl database
'81'x is a byte that must only appear as a continuation byte in UTF-8. Even in Windows 1252, it is not used.
I suggest you inspect your data to see where it appears. It might be you have binary coded values (e.g. a UUID stored in 16 bytes) that need to be translated with a DBSASTYPE option.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.