BookmarkSubscribeRSS Feed
V_Andy
Fluorite | Level 6
Hi!
I've got problems impoting DOS TXT File to SAS Server using EG Import File Wizard. The problem results in trimming some values of character string.

For instance, for a character field SAS assigned field width equaled 25 characters.

Performing File import procedure results in creating a SAS Data set.

Verifying obtained SAS Data set I've noticed that there were some observations with fields length originally greater than 25 which result in trimming such values from the right side from their initial length to 25 symbols.

It's absolutely unclear for me how SAS calculates the maximum width of the character fiels. I never had such problems in Excel or Access.

The only understandable way of fixing the problem is to determine somehow the length of the longest string of the field and to correct informat manually prior to start import procedure. In most cases it is hard to accomplish due to giant number of observations.

Please help me avoid importing txt data trimming, help me make SAS understand maximum field width.

P.S.
For Excel Files Import in EG we have special option "Use longest value as column width" (Tools\Options\Perfomance)
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
What version of EGuide? The Excel import got a lot smarter in 4.2.

Another possibilitiy: Was it the last field imported in a row? Sometimes non-printable (control) characters can cause problems. and are two that can be nasty to deal with.
V_Andy
Fluorite | Level 6
SAS Enterprise Guide 4.1 (4.1.0.1013)

I'm talking about import of DOS TEXT Format but not Excel.
This is neither the last field nor the last row.
The problem is that within the column values may have various length. In my case I have a table with 3 000 rows.

Initially (before import procedure) in one column I have:
OTHER
HYPOVOL
NONSHOCK
BACTER
CRYSTAL
DISCUSSION
COMMUNITY

For the column shown above EG assigns a width of 7 symbols.

After performing File Import procedure I obtain trimming in lines # 3, 6 and 7:

OTHER
HYPOVOL
NONSHOC
BACTER
CRYSTAL
DISCUSS
COMMUNI

For the exact column I could assign the column width manually (editing informat option) but due to huge number of rows (about 3 milion) I can't determine the longest string.
I thing that there is either special option or special informat in SAS EG with variable string width.
Does anybody know how to solve the problem?

Message was edited by: V.Andy Message was edited by: V.Andy

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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