Victor
Victor

Reputation: 17107

Specifying a range for character values in DATALINES in SAS

In this example:

data testfile;
   input x $ y $ 9-17 z $ 19-26; 
   datalines; 
apple   banana    coconut
apple   banana    coconut 
apricot blueberry citron
; 

What does the 9 -17 and 19- 26 do? These are characters, why are we giving a numeric range?
I picked the example from SAS

Upvotes: 0

Views: 288

Answers (1)

Tom
Tom

Reputation: 51611

The numbers are the character position in the line to read. So y $ 9-17 means that you want to read the 9 character string starting at column 9 and continuing through column 17 into the variable Y. The $ is what tells SAS the Y is a character variable and not a number.

Upvotes: 2

Related Questions