Date: Wed, 6 May 1998 10:17:19 +0500
Reply-To: Bernard Tremblay <bernard@CAPITALE.QC.CA>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Bernard Tremblay <bernard@CAPITALE.QC.CA>
Subject: Re: File input: Combination of delimeter and missing values
Hi,
Add the "dsd" options to your infile statement to tell SAS
it's a "comma" separated file and it will work!
regards,
Bernard Tremblay
\\\|///
\\ - - //
( @ @ )
+------oOOo-(_)-oOOo----------+---------------------------------+
| Bernard Tremblay | |
| La Capitale | Tel: (418) 646-2401 |
| | Fax: (418) 646-5960 |
| | Int: bernard@capitale.qc.ca |
+-----------------------------+---------------------------------+
| Imaginasys enr | Res: (418) 878-4447 |
| | Int: bertrem@quebectel.com |
+---------------Oooo----------+---------------------------------+
oooO ( )
( ) ) /
\ ( (_/
\_)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>Date: Mon, 4 May 1998 13:35:44 +0200
>>>From: Maarten Zaanen <Maarten.Zaanen@NL.ORIGIN-IT.COM>
>>>Subject: File input: Combination of delimeter and missing values
>>>To: SAS-L@UGA.CC.UGA.EDU
>>>Content-Type: text
>>>Content-Length: 1565
>>>
>>>Hello world,
>>>
>>>I have a problem with the combination of a file delimeter and missing
>>>values. An example:
>>>
>>> data test1;
>>> infile 'c:\temp\comma1.txt' truncover dlm=',';
>>> length dum1-dum4 $8;
>>> input dum1-dum4;
>>> run;
>>> proc print; run;
>>>
>>>The contents of the c:\temp\comma1.txt file are:
>>>x1,x2,x3,x4
>>>c1,,c3,c4
>>>,,c3
>>>,c2,,c4
>>>
>>>What I would like to get in dataset "test1" is:
>>> OBS DUM1 DUM2 DUM3 DUM4
>>>
>>> 1 x1 x2 x3 x4
>>> 2 c1 c3 c4
>>> 3 c3
>>> 4 c2 c4
>>>
>>>What I get using the above program, however, is:
>>>
>>> OBS DUM1 DUM2 DUM3 DUM4
>>>
>>> 1 x1 x2 x3 x4
>>> 2 c1 c3 c4
>>> 3 c3
>>> 4 c2 c4
>>>
>>>Does anyone have an elegant solution now all I can think of is:
>>>
>>> 1) test if first character on a line is a delimiter, if so, add a space
>>>in front
>>> 2) test if 2 successive characters are delimiters, if so, add a space in
>>>between.
>>>
>>>I fear this may get messy / nasty, especially if the input lines are longer
>>>than 200 characters (guess how long the lines in my real files are...).
>>>
>>>Any suggestions much appreciated,
>>>
>>>
>>>--
>>>Best Regards,
>>>
>>>Maarten Zaanen
>>>e-mail Maarten.Zaanen@nl.origin-it.com
>>>The opinion expressed is my own and not (necessarily) that of Origin
>>>
|