DATA Step, Macro, Functions and more

Skip records while reading variable length delimited file

Reply
N/A
Posts: 0

Skip records while reading variable length delimited file

Hello,

I am reading a variable length file delimited by hex 00 on mainframe. I notice my SAS program is skipping every other record in the file. The record format is VB. Record length is defined as 1000. When I browse the file, I see that its record length is 996. But I changed the in_rec to char996 and the same thing happened.

Any input would be greatly appreciated!!

DATA A;
INFILE IN1;
INPUT @1 IN_REC $CHAR1000.;

NEW1 = TRANSLATE(IN_REC,"~","00"X);
FILE OUT1;
PUT @1 NEW1;
RUN;

Here is the Input File:

0000000010.N.N.GC..GRODBI.1994-08-09.1994-08-09-09.06.17.002043.1994-08-09...cod
0000000010.N.N.HD..GROSAH.2002-06-05.2002-06-05-11.37.30.001991.2002-06-05...NAT
0000000011.Y.N.CF..MDVNKB.2002-11-12.2002-11-12-15.51.09.002000.2002-11-12.MDVNK
0000000011.Y.N.CF..MDVNKB.2007-01-22.2007-01-22-14.42.09.001995.2007-01-22.MDVNK
0000000011.Y.N.GC..MDVAGS.2007-09-19.2007-09-19-11.44.01.001991.2007-09-19.MDVAG
0000000016.Y.N.PM..ASD.1999-03-24.1999-03-24-16.04.58.002104.1999-03-24.ASDJHD..
0000000016.Y.N.GC..UDVWAC.2000-01-20.2000-01-20-15.54.34.002024.2000-01-20.RESEA
0000000016.Y.N.PM..DUASCR.2000-10-11.2000-10-11-10.22.55.002008.2000-10-11.DUASC



Here is the output file:

0000000010~N~N~HD~~GROSAH~2002-06-05~2002-06-05-11.37.30.001991~2002-06-05~~~NAT
0000000011~Y~N~CF~~MDVNKB~2007-01-22~2007-01-22-14.42.09.001995~2007-01-22~MDVNK
0000000016~Y~N~PM~~ASD~1999-03-24~1999-03-24-16.04.58.002104~1999-03-24~ASDJHD~~
0000000016~Y~N~PM~~DUASCR~2000-10-11~2000-10-11-10.22.55.002008~2000-10-11~DUASC
Respected Advisor
Posts: 3,799

Re: Skip records while reading variable length delimited file

Posted in reply to deleted_user
I would try TRUNCOVER INFILE statement option.
Ask a Question
Discussion stats
  • 1 reply
  • 135 views
  • 0 likes
  • 2 in conversation