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: Call for Content

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!

Submit your idea!

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.

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
  • 520 views
  • 2 likes
  • 3 in conversation