Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

single and double trailing

Status
Not open for further replies.

roland9

Technical User
Feb 8, 2006
17
0
0
US
Hey guys,
I am trying to understand the difference between @ and @@. For the data below both works.So whats the diff and why do we need another @ (input sales :comma.)to read the data below...(Is there a simple way to solve problems with single and double trailing)

DATA
0734 1,323.34 2,472.85 3,276.65
0987 1,393.34 9,472.85 2,276.65

*Problem_1;

data Single;
infile test;
input id $ @@; *Double trailing works;
do qtr = 1 to 3;
input sales :comma.@; *Why single trailing here;
output;
end;
run;

*Problem_2;

data Single;
infile test;
input id $ @; *Single trailing works;
do qtr = 1 to 3;
input sales :comma.@; *Why single trailing here;
output;
end;
run;

 
This is explained in the documentation online.


Look under Base SAS > SAS Language Reference: Dictionary > Dictionary of Language Elements > Statements > Input > Using Line-Hold Specifiers.

Basically, a single trailing @ allows multiple INPUT statements to read the same line of data, however, these all go to the same observation, the next iteration of the datastep reads the next line of data.
A double trailling @ allows you to write out multiple records from the same line of data.
This is more fully explained in the doco though. If you have an earlier version of SAS this shouldn't be a problem, I don't beleive this has changed in a long time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top