1.

What Is The Purpose Of The Trailing And How Would You Use Them?

Answer»

If the data is continuosly in data SET SAS would read the first WORDS only from each line in the `datelines' block and it will ignore the rest of the line. if we use Trailing @@'it will read completly.and another TYPE of trailing is using single @ this is a line hold SPECIFIER.

  • Trailing @ is used to hold the record in input buffer to execute another input statement on the same datelines.
  • Trailing @@ is used to hold the record in input buffer to execute same input statement on same datelines intel eof record.
  • The trailing @ or more technically, line hold specifiers are used to hold the pointer in the same record for multiple iterations. 
  • The two tyoes of line hold specifiers are single trailing(@) and double trailing(@@).
  • The single trailing hold the record until it encounters either another input statement or end of the data step.

They are used for the records such as 

001F38 H

002 F 40 G

To read these values to the data step

Data example:

input @10 type $ @;

if type='H' then

input @1 id 3. @4 GENDER $1. @5 age2.;

else if type='G' then

input @1 id3. @5 gender $1. @7 age 2.;

end;

cards;

001F38 H

002 F 40 G

;

run;

The double trailing holds the until the end of the record.

Data example2:

input id age @@;

cards;

001 23 002 43 003 65 004 32 005 54

;

run;

If the data is continuosly in data set SAS would read the first words only from each line in the `datelines' block and it will ignore the rest of the line. if we use Trailing @@'it will read completly.and another type of trailing is using single @ this is a line hold specifier.

They are used for the records such as 

001F38 H

002 F 40 G

To read these values to the data step

Data example:

input @10 type $ @;

if type='H' then

input @1 id 3. @4 gender $1. @5 age2.;

else if type='G' then

input @1 id3. @5 gender $1. @7 age 2.;

end;

cards;

001F38 H

002 F 40 G

;

run;

The double trailing holds the until the end of the record.

Data example2:

input id age @@;

cards;

001 23 002 43 003 65 004 32 005 54

;

run;



Discussion

No Comment Found