Interview Questions   Tutorials   Discussions   Programs   Videos   

SAS - What is the purpose of the trailing and How would you use them?

asked mar September 20, 2014 06:30 AM  

What is the purpose of the trailing and How would you use them?


1 Answers

answered By vishnoiprem   0  

If a variable doesn’t have a single trailing @ with an input statement, when sas encounters another input statement after the first one,it would load a new record, this action will result in some observations not been outputted and missing data. To avoid this, a single trailing @ is used to hold the record , so that when it encounters another input statements within the datasets a new record is not loaded, It basically tells sas to use the data just placed in the input buffer for the next input statement . the single trailing @ is release when an input statement without a trailing @ is encountered.

`input zz$ status ’ tells SAS to read two words at a time from the input buffer to the pdv without discarding the rest of the line.Without the trailing , SAS would read the first two words from input buffer and ignore therest of the line. This would result in reading less records.

They are used for the records such as
001F38 H
002 F 40 G
To read these values to the datastep
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.;
001F38 H
002 F 40 G

The double trailing holds the until the end of the record.
Data example2;
input id age ;
001 23 002 43 003 65 004 32 005 54
   add comment

Your answer

Join with account you already have



 Write A Tutorials
Online-Classroom Classes

  1 person following this question

  Question tags

sas × 1

Asked 1 year and 1 month ago ago
Number of Views -218
Number of Answers -1
Last updated
2 years and 1 month ago ago

Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!