Fluorite | Level 6

## understanding sas base question

Hi,

Which SAS statement correctly uses column input to read the values in the raw data file below in this order: Address (4th field), SquareFeet (second field), Style (first field),
Bedrooms (third field)?

1--+----10---+----20---+----30

2STORY   5500 7 MUMBAI71 NEW

ALATE      2200 4 RANE STREET

MONTE    5200 3 MUKESH STREET

1. input Address 15-29 SquareFeet 8-11 Style 1-6
Bedrooms 13;
2. input \$ 15-29 Address 8-11 SquareFeet \$ 1-6 Style
13 Bedrooms;
3. input Address \$ 15-29 SquareFeet 8-11 Style \$ 1-6
Bedrooms 13;
4. input Address 15-29 \$ SquareFeet 8-11 Style 1-6
\$ Bedrooms 13;

Doubt=  what is the  1--+----10---+----20---+----30 means in the question?

thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: understanding sas base question

@shubhamtiwari wrote:

@Kurt_Bremser  than you for the reply, but still i did not understood the meaning of those numbers  1,10,20,30

1--+----10---+----20---+----30

what if we have like this 5--+----15---+----19---+----44

here what does these numbers 5,15,19,44 represent?

```1---+----10---+----20---+----30
2STORY   5500 7 MUMBAI71 NEW
111111111122222222223
123456789012345678901234567890```

The 3rd and 4th rows expand on the idea. Again important is to view things with a fixed width font

1

0

above indicates position number 10, of the first 5 in second row, The + are the values ending in 5 such as 15, 25

Position 20 is the B in Mumbai.

it is only a tool for counting columns. Nothing magic or difficult.

5 REPLIES 5
Super User

## Re: understanding sas base question

@shubhamtiwari wrote:

Hi,

Which SAS statement correctly uses column input to read the values in the raw data file below in this order: Address (4th field), SquareFeet (second field), Style (first field),
Bedrooms (third field)?

1--+----10---+----20---+----30

2STORY   5500 7 MUMBAI71 NEW

ALATE      2200 4 RANE STREET

MONTE    5200 3 MUKESH STREET

1. input Address 15-29 SquareFeet 8-11 Style 1-6
Bedrooms 13;
2. input \$ 15-29 Address 8-11 SquareFeet \$ 1-6 Style
13 Bedrooms;
3. input Address \$ 15-29 SquareFeet 8-11 Style \$ 1-6
Bedrooms 13;
4. input Address 15-29 \$ SquareFeet 8-11 Style 1-6
\$ Bedrooms 13;

Doubt=  what is the  1--+----10---+----20---+----30 means in the question?

thank you

This line is just a ruler for horizontal orientation. It becomes more useful when viewed with a fixed-space font:

```1---+----10---+----20---+----30

2STORY 5500 7 MUMBAI71 NEW
ALATE  2200 4 RANE STREET
MONTE  5200 3 MUKESH STREET```
Fluorite | Level 6

## Re: understanding sas base question

@Kurt_Bremser  than you for the reply, but still i did not understood the meaning of those numbers  1,10,20,30

1--+----10---+----20---+----30

what if we have like this 5--+----15---+----19---+----44

here what does these numbers 5,15,19,44 represent?

Super User

## Re: understanding sas base question

1 is position 1 in the input line.

The "1" of "10" marks position 10 (the "0" is therefore position 11), and so on.

Only the 10s are been marked like that, so you won't see 5 or 15. This is also close to the way SAS puts a ruler into the log when it shows external data being read by a data step.

Run this code for reference:

``````filename test temp;

data _null_;
file test;
put "12345";
put "67890";
run;

data _null_;
infile test;
input;
list;
run;

filename test clear;``````

Super User

## Re: understanding sas base question

Just to clarify: the ruler line is NOT part of the data, it is there only to make finding a start position for reading a variable easier.

Super User

## Re: understanding sas base question

@shubhamtiwari wrote:

@Kurt_Bremser  than you for the reply, but still i did not understood the meaning of those numbers  1,10,20,30

1--+----10---+----20---+----30

what if we have like this 5--+----15---+----19---+----44

here what does these numbers 5,15,19,44 represent?

```1---+----10---+----20---+----30
2STORY   5500 7 MUMBAI71 NEW
111111111122222222223
123456789012345678901234567890```

The 3rd and 4th rows expand on the idea. Again important is to view things with a fixed width font

1

0

above indicates position number 10, of the first 5 in second row, The + are the values ending in 5 such as 15, 25

Position 20 is the B in Mumbai.

it is only a tool for counting columns. Nothing magic or difficult.

Discussion stats
• 5 replies
• 970 views
• 1 like
• 3 in conversation