I'm new to databases and having an issue with sorting/merges. I currently work in base SAS. I connect to my data tables in PostgreSQL 13 using the following code:
libname name odbc dsn="PostgreSQL30" schema="schemaname";
I am having an issue merging tables between the two platforms, as SAS doesn't recognize the sort order from PostgreSQL, despite the fact that I know both are sorted "correctly" (by the same variables, in the same variable order). Are there optimal encoding and collation settings in PostgreSQL that are compatible with SAS? Our current settings are:
Encoding = 'UTF8'
LC_Collate = 'English_United States.1252'
LC_Type= 'English_United States.1252'
The encoding for the SAS table I'm working with is 'latin1 Western (Windows)' and my understanding is that SAS uses binary collation as a default. Thank you for any assistance.
ORDER BYclause. To get the binary sorting order in PostgreSQL, useORDER BY col COLLATE "C".