Desktop productivity for business analysts and programmers

Trimming during Import File Procedure

Occasional Contributor
Posts: 13

Trimming during Import File Procedure

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.

For Excel Files Import in EG we have special option "Use longest value as column width" (Tools\Options\Perfomance)
Trusted Advisor
Posts: 2,127

Re: Trimming during Import File Procedure

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.
Occasional Contributor
Posts: 13

Re: Trimming during Import File Procedure

SAS Enterprise Guide 4.1 (

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:

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:


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
Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation