Help using Base SAS procedures

Readin text file

Accepted Solution Solved
Reply
Contributor
Posts: 57
Accepted Solution

Readin text file

Hello-

I am trying to read in a text file (pointer/postion file)  I am following the file layout (start and stop positons) but it seems SAS is not reading/scanning the data positions I've specified. I've attached my code below - for the very last variable, SAS seems to be starting back at position 1.    (everything looks fine in output except for the very last variable)

DATA file1; INFILE CAH OBS=1000 ;

INPUT

@23  GRADE $2.

@25  LAST_NAME $11.

@36  FIRST_NAME $9.

@56  DOB $8.

@64  GENDER $1.

@134 ELA_MOD1 $1.

@135 ELA_MOD2 $1.

@136 ELA_MOD3 $1.

@137 ELA_MOD4 $1.

@138 ELA_MOD5 $1.

@139 ELA_MOD6 $1.

@140 ELA_MOD7 $1.

@141 ELA_MOD8 $1.

@142 ELA_MOD9 $1.

@143 ELA_MOD10 $1.

@144 ELA_MOD11 $1.

@145 ELA_MOD12 $1.

@146 ELA_MOD13 $1.

@147 ELA_MOD14 $1.

@148 ELA_MOD15 $1.

@149 ELA_MOD16 $1.

@150 ELA_MOD17 $1.

@151 ELA_MOD18 $1.

@154 ELA_MODYN $1.

@155 MATH_MOD1 $1.

@156 MATH_MOD2 $1.

@157 MATH_MOD3 $1.

@158 MATH_MOD4 $1.

@159 MATH_MOD5 $1.

@160 MATH_MOD6 $1.

@161 MATH_MOD7 $1.

@162 MATH_MOD8 $1.

@163 MATH_MOD9 $1.

@164 MATH_MOD10 $1.

@165 MATH_MOD11 $1.

@166 MATH_MOD12 $1.

@167 MATH_MOD13 $1.

@168 MATH_MOD14 $1.

@169 MATH_MOD15 $1.

@172 MATH_MODYN $1.

@203 MATH_SCORE 3.

@248 ELA_SCORE 3.

@455 SSID $10.

;

run;


Accepted Solutions
Solution
‎11-28-2012 02:25 PM
PROC Star
Posts: 7,366

Re: Readin text file

add an lrecl=32767 to your infile statement.  Is should be set to a number equal to or greater then the actual length of the file you are trying to read.

View solution in original post


All Replies
Solution
‎11-28-2012 02:25 PM
PROC Star
Posts: 7,366

Re: Readin text file

add an lrecl=32767 to your infile statement.  Is should be set to a number equal to or greater then the actual length of the file you are trying to read.

Contributor
Posts: 57

Re: Readin text file

Ohh thank you.  I had forgotten to set lrecl.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 146 views
  • 1 like
  • 2 in conversation