BookmarkSubscribeRSS Feed
Bal23
Lapis Lazuli | Level 10

I need to read a large dataset, infile from *.dat

I set irecl=32767 the maxim value

 

the log showed

The minimum record length was 20000.

The maximum record length was 20000.

and for the date, the log showed a warning

"has already been defined as numeric"

 

 

 

Any advice how to change irecl to the right value?

11 REPLIES 11
Bal23
Lapis Lazuli | Level 10

you are right.

I find sas stops before the varible "date", so I format the date, then there is a warning

it seems not necessary to format

all are charcters, no delimiters, a lot of space, so I have all the code with the location and length of the variables

 

INFILE 'c:\abc.DAT' truncover lrecl=30000

obs=300;

   INPUT  
@59 id $1.		@139 fname4 $4.	..
@11593 cdc $8.;
Run;
Bal23
Lapis Lazuli | Level 10

I adjusted irecl from 20000 to the maxim, the record is 20000

but it dos not read right for the rest part

Bal23
Lapis Lazuli | Level 10

see my log below, please

Kurt_Bremser
Super User

To repeat myself:

To help you, we need the whole log of the data step including the ERROR message.

Whole log means "including the code that caused the ERROR".

Just copy/paste from the log; it's not rocket science.

ChrisNZ
Tourmaline | Level 20

so your code reads:

 

format DATE date9.;
input  ....   DATE $8. .... ;

 

Well the error is exactly was it says: you have defined the variable as numeric (with the format statement) and then you want to read it as a string. 

 

Formatting the date will not force reading its value. You have to look at where in the record the reading stops and why. One way to do it is

 

infile ... lrecl=30000 pad truncover;
input X $30000.;

and then use substr() to analyse the contents of X (use _infile_ instead of X if you know about _infile_, otherwise just use the X variable to do your investigation).

 

 

Bal23
Lapis Lazuli | Level 10

Thanks

I tried yours. it does not change, still it cant not read the rest part

 

5 records were read from the infile

' c:\abc.DAT'.

The minimum record length was 20000.

The maximum record length was 20000.

NOTE: The data set WORK.CONTEST has 5 observations and 213 variables.

NOTE: DATA statement used (Total process time):

real time 0.17 seconds

cpu time 0.07 seconds

 

ChrisNZ
Tourmaline | Level 20

1) How long is your text file record length? At least 20k it seems; try using lrecl=32767

 

2) What's the position of the date in the record?

Bal23
Lapis Lazuli | Level 10

I do not understand that, "What's the position of the date in the record?"

 

I have adjusted the value of lrecl, with many different values, it did not work

ChrisNZ
Tourmaline | Level 20

"What's the position of the date in the record?"  means: how many characters do you have to count on your text input record before the date is found?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 11 replies
  • 2779 views
  • 0 likes
  • 3 in conversation