Date: Mon, 3 Mar 1997 09:53:50 +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: Raw data set
Hi,
A simple way of doing this is to position the input pointer after
the first '.' and then read relatively from this position. Example:
data yourfile;
infile "c:\strange.dat" ;
input @1 dot $char10. @;
pos=index(dot,'.')+1; /*Position input cursor after dot */
input @pos year 4.
+5 gnp $char5.
+3 consum $char6.
;
drop dot pos;
run;
Hope it helps,
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 ( )
( ) ) /
\ ( (_/
\_)
>>>From owner-sas-l@UGA.CC.UGA.EDU Mon Mar 3 09:39 EST 1997
>>>Mime-Version: 1.0
>>>Content-Transfer-Encoding: 7bit
>>>Date: Mon, 3 Mar 1997 10:24:16 -0800
>>>Subject: Re: Raw data set
>>>Comments: To: pll <pledesma@cezanne.helios.nd.edu>
>>>To: Multiple recipients of list SAS-L <SAS-L@UGA.CC.UGA.EDU>
>>>
>>>pll wrote:
>>>>
>>>> I am helping a friend trying to read a strange (perhaps corrupted in
>>>> transfering from one system to another) raw data set. Every record starts
>>>> with a "."; in some lines (generally odd lines) there are 2 leading spaces
>>>> before the period; in other lines, there are 3 leading spaces. After the
>>>> period, the data is aligned in fixed columns (that is, if you counted
>>>> startng after the period). I am attaching one file similar to the one
>>>> causing problems (since that one takes a couple of MB). The positions of
>>>> the variables after the period would be:
>>>> variable column location
>>>> ---------------------------
>>>> year 1-4
>>>> gnp 9-14
>>>> consum 17-22
>>><snip>
>>>>
>>>> Any suggestions (tried missover option in the infile statement, a couple
>>>> of informats)? Does anyone know how to use the colun pointer controls in
>>>> the INPUT statement (specifically, is it possible to declare column 1 the
>>>> first character after the period in each line of the data file?)?
>>>>
>>>
|