| Date: | Wed, 5 Feb 2003 01:53:02 -0800 |
| Reply-To: | Jochen Czemmel <jochen.czemmel@GMX.DE> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Jochen Czemmel <jochen.czemmel@GMX.DE> |
| Organization: | http://groups.google.com/ |
| Subject: | Re: Importing tab delimited files |
| Content-Type: | text/plain; charset=ISO-8859-1 |
Hi debbie!
Try the line hold specifier @ in the input statement:
data results;
length b $1;
infile 'c:\tmp\tabdel.csv' firstobs=2 delimiter='09'x;
input id type @;
if type=1 then input a b;
else input b;
run;
data (tab-delimited): c:\tmp\tabdel.csv
nummer type a b
1 1 1 a
2 1 2 b
3 2 c
4 1 4 d
5 2 e
Kind Regards
Jochen
debbie.cooper@STEVENSONCOMPANY.COM (Debbie Cooper) wrote in message news:<IIEJLJCPGNLOFKLAJENPIEIACJAA.debbie.cooper@stevensoncompany.com>...
> We will be receiving survey results in the form of tab delimited files soon.
> 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 in
> tab-delimited format with the field names in the first row of the file. The
> 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 a
> 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 that
> 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.
>
> Thanks,
> Debbie
|