Using INPUT @ ' text' positions the input pointer directly
after the word 'text'.
DATA NAMES;
LENGTH NAME CITY $10 ;
INPUT @1 NAME @ 'CITY=' CITY AGE ;
DATALINES;
ABC CITY=BGLR 25
DEFGH CITY=HYD 30
IJKLMNO CITY=BGLR 28
PQRS CITY=HYD 26
;
RUN;
PROC PRINT DATA=NAMES;
RUN;;
output
Obs NAME CITY AGE
1 ABC BGLR 25
2 DEFGH HYD 30
3 IJKLMNO
BGLR 28
4 PQRS HYD 26
If the text is not found, the pointer will go to a new line
DATA NAMES;
LENGTH NAME CITY $10 ;
INPUT @1 NAME @ 'CITY=' CITY AGE ;
DATALINES;
ABC CITY=BGLR 25
DEFGH CITY=HYD 30
IJKLMNO BGLR 28
PQRS CITY=HYD 26
;
;
RUN;
PROC PRINT DATA=NAMES;
RUN;
output
Obs NAME CITY AGE
1 ABC BGLR 25
2 DEFGH HYD 30
3 PQRS HYD 26
in above example IJKLMNO is missing because the string CITY=
not found,so the pointer will go to a new line.
No comments:
Post a Comment