|Date: ||Fri, 31 Jan 2003 17:14:07 -0500|
|Reply-To: ||"Gerstle, John" <yzg9@CDC.GOV>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||"Gerstle, John" <yzg9@CDC.GOV>|
|Subject: ||Re: Importing tab delimited files|
|Content-Type: ||text/plain; charset="iso-8859-1"|
Try this work around. Create a test dataset with sample data in every
field, maybe like 10 rows or so. Import into SAS, along with the other
datasets. Append (via PROC APPEND) all the others to this sample dataset
(i.e. BASE=SAMPLEDATASET). Then in a subsequent data step, delete all rows
of the test data (IF SITE=test THEN DELETE). This gives you some control
over how SAS will read in the other datasets. If variables don't match,
you'll get messages in the log.
CDC Information Technological Support Contract (CITS)
Phone: 404-639-3980 Fax: 404-639-2980
Cell: 770-639-5060 Email: email@example.com
> -----Original Message-----
> From: Debbie Cooper [mailto:debbie.cooper@STEVENSONCOMPANY.COM]
> Sent: Friday, January 31, 2003 4:14 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Importing tab delimited files
> We will be receiving survey results in the form of tab delimited files
> There will be about 180 files representing different products that we
> research. The problem I'm having is that the files are being sent to me
> tab-delimited format with the field names in the first row of the file.
> data is such that if no respondent answers a particular question, that
> field/column will not show up. So there won't be an empty space
> representing no answer, the field simply won't be there.
> Because of this I've tried to use Proc Import to read the files but what's
> happening is SAS reads each file and can potentially assign different
> formats to the same fields in different files. Not only that but we have
> few text fields (open-end questions) as well and SAS is apparantly looking
> at the first record and deciding what length to give these fields, so
> subsequent records can have the fields truncated.
> SAS tells me I need to use an INFILE statement to read these files and
> makes sense except for the fact that I'll never know which fields will or
> won't show up in the files.
> Any suggestions would be greatly appreciated.