BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
bhaskarkothavt
Obsidian | Level 7

Hello SAS Community,

I am writing to request assistance with an issue I'm encountering while reading data from PostgreSQL tables into SAS Studio using Viya4.

The Problem: When I read tables containing text columns, SAS seems to be interpreting them incorrectly. Instead of reading the original text values (e.g., size 4), the software defaults format, length and informat to $1025.

 

I've verified that all the text columns in my PostgreSQL tables are defined as "character varying." I'm unsure why SAS is assigning to 1025 instead of original size 4.

 

I would greatly appreciate it if you could help me understand why this is happening and suggest possible solutions to read data from my PostgreSQL tables.

Thanks & Regards,
Bhaskar

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Usually it makes a difference what the data type is in the foreign database.  Looking on-line I see four different character types in Postgresl.

 

Tom_0-1720636967355.png

The last two do NOT have anything that indicates the maximum length that SAS can use to determine how to define the SAS variable.  In those cases SAS will normally use some default length like 4k bytes or the 1k bytes that you seem to be seeing.

View solution in original post

3 REPLIES 3
SASJedi
SAS Super FREQ

What do you mean by "size 4"? Are you saying that the PostgreSQL table columns are VARCHAR(4) but SAS is converting them to CHAR(1024)?

Check out my Jedi SAS Tricks for SAS Users
bhaskarkothavt
Obsidian | Level 7
Yes that is correct.
Tom
Super User Tom
Super User

Usually it makes a difference what the data type is in the foreign database.  Looking on-line I see four different character types in Postgresl.

 

Tom_0-1720636967355.png

The last two do NOT have anything that indicates the maximum length that SAS can use to determine how to define the SAS variable.  In those cases SAS will normally use some default length like 4k bytes or the 1k bytes that you seem to be seeing.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1206 views
  • 2 likes
  • 3 in conversation