info@sastechies.com
http://www.sastechies.com
Character data with specified lengths
>----+----10---+----20
This external file contains data that is arranged
in columns or fixed fields. You can specify a 2810 61 MOD F
2804 38 HIGH F
beginning and ending column for each field. 2807 42 LOW M
2816 26 HIGH M
Let's look at how column input can be used to 2833 32 MOD F
2823 29 HIGH M
read this data.
2810 61 MOD F
2804 38 HIGH F
2807 42 LOW M
2816 26 HIGH M
2833 32 MOD F
2823 29 HIGH M
The
input Name $14. @16 Amount comma6.2 damout var +n is a relative
pointer control that
input Name $14. +2 Amount comma6.2 damout var moves the input pointer
forward to a column
number relative to the
current position.
34.0008
7.4
34.0008
>----+----10---+----20---+---------------
BIRD FEEDER LG088 3 20
GLASS MUGS SB082 6 12
GLASS TRAY BQ049 12 6
PADDED HANGRS MN256 15 20
JEWELRY BOX AJ498 23 0
RED APRON AQ072 9 12
CRYSTAL VASE AQ672 27 0
PICNIC BASKET LS930 21 0
◦ Beware of Errors
◦ infile receipts pad;
fields
HEINS*W.*PUBLICATIONS*$9,539
delimiter
infile credit dlm=‘ ‘; input
Gender $ Age Bankcard
FreqBank
Deptcard FreqDept;
MALE 27 1 8 92 39
FEMALE * 3 14 5 10
FEMALE 34 2 10 3 3
COURTNEY MARK
PUBLICATIONS TW01 one INPUT statement that
$24,006.16
You use the forward slash (/) line contains a line pointer control to
pointer control to read multiple specify the record(s) from which
records in sequential order. values are to be read
input Lname $ 1-8 Fname $ 10- input
15 / Department $ 1-12
JobCode $ 15-19 / Salary #1 Lname $ 1-8 Fname $ 10-15
comma10.; #2 Department $ 1-12 JobCode $
#3 Salary comma10.;
an ID field followed by a
varying number of
>----+----10---+----20---+----30--
001 WALKING
002 SWIMMING CYCLING SKIING
003 TENNIS SWIMMING repeating fields that
represent separate
observations.
>----+----10---+----
H 325A S. MAIN ST
P JAMES L 34 M
P LIZA A 31 F
H 325B S. MAIN ST
P MARGO K 27 F
P WILLIAM R 27 M
P ROBERT W 1 M
data perm.phones;
infile phondat length=reclen;
input ID 4. @;
namelen=reclen-9;
input Name $varying10. namelen PhoneExt;
data perm.health;
infile bpdata length=reclen;
input ID 4. @;
do index=6 to reclen by 15;
input Date : date. BP $ @;
output;
end;
run;