Tuesday, 13 October 2015

Data Step Tip: Trailing @ For Efficiency

Use the trailing "@" with input statements to avoid inputting records you wish to eliminate.


 Instead of: 



DATA MIDWEST;
INFILE ACCOUNTS;
INPUT @1 NAME $19.
@20 STATE $2.
@24 ACCTNBR $10.
@35 BALANCE 8.;
IF STATE IN ('WI','MN','IA');
RUN;


Better:

DATA MIDWEST;
INFILE ACCOUNTS;
INPUT @20 STATE $2. @;
IF STATE IN ('WI','MN','IA') THEN
INPUT @1 NAME $19.
@24 ACCTNBR $10.
@35 BALANCE 8.;

RUN;




• More Efficient

• Different Layouts in One File

No comments:

Post a Comment