| Date: | Tue, 31 Dec 1996 16:17:27 -0500 |
| Reply-To: | rcoleman@worldnet.att.net |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | Ron Coleman <rcoleman@WORLDNET.ATT.NET> |
| Organization: | Links Analytical, Inc. |
| Subject: | Re: Binary Files |
| Content-Type: | text/plain; charset=us-ascii |
Erik Engstrom wrote:
>
> I would like to thank Arlin Collins, Tom Abernathy, Bob Duell, Andrew
> Smith and Karl Schimanko for thier responses to my post. I did not know
> about the informats for binary data. I found out that there is a 24
> bite header at the beginning of each data file. My program works fine
> as long as I cut the header out with a binary editor before running.
> How do I tell SAS to skip the first 24 bites of the data file?
> I included my program below just in case those of you who helped me were
> interested in what I ended up with. As you can see it turns out that
> the file structure was very different than I was origionally told.
>
> data trafdat.detect;
> infile 'c:\trafdat\tstfile.dat' recfm=f lrecl=9454;
> array vol(3150) vol1-vol3150;
> array occ(3150) occ1-occ3150;
> array err(3150) err1-err3150;
> array flag(3150) flag1-flag3150;
> array stat(3150) stat1-stat3150;
> input (time) (pib4.) @;
> do i=1 to 3150;
> input (vol(i) occ(i) err(i)) (pib1.) @;
> stat(i)=int(err(i)/16);
> flag(i)=mod(err(i),16);
> end;
> time=time+315597600;
> format time datetime16.;
> drop err1-err3150 i;
>
> run;
>
> Like I said it runs fine, I just need it to skip the first 24 bites of
> the data file.
>
> Thanks in advance,
>
> Erik Engstrom
> Research Analyst
> Minnesota Department of Transportation
> eman@minn.net
Erik,
To skip the first 24 bytes (characters) on each record you can use
the input statement before your DO loop to move the pointer 24 spaces:
INPUT +24 @; * Skip 24 bytes and hold the line for the next INPUT;
do i=1 to 3150;
...
end;
--
Ron Coleman
Links Analytical, Inc. Linking your data to your business!
3545-1 St. Johns Bluff Rd. Suite 300
Jacksonville FL 32224
rcoleman@worldnet.att.net
|