BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Syntas_error
Quartz | Level 8
I apologize if this question is very basic, but I, haven't been able to find a straightforward answer.

What's the difference between using a trailing @ and a trailing @@?

Is the trailing @ temporary (lasts for one/two iterations) while the @@ is permanent (until theree are no more values in the row)?
1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

The single @ is temporary, for the current iteration of the DATA step only.

 

The double is permanent.  The only way to get to the next line includes:

 

  • Executing another INPUT statement that does not end with @@
  • Attempting to read past the end of the line, with neither TRUNCOVER nor MISSOVER in effect

View solution in original post

3 REPLIES 3
Astounding
PROC Star

The single @ is temporary, for the current iteration of the DATA step only.

 

The double is permanent.  The only way to get to the next line includes:

 

  • Executing another INPUT statement that does not end with @@
  • Attempting to read past the end of the line, with neither TRUNCOVER nor MISSOVER in effect
Tom
Super User Tom
Super User

Why not play with it and see what happens?

data test1;
  interation+1;
  do col=1 to 3 ;
    input x @;
    output;
  end;
cards;
1 2 3 4 5 6 
7 8 9 10 11 12
;

proc print;
run;

data test2;
  interation+1;
  do col=1 to 3 ;
    input x @@;
    output;
  end;
cards;
1 2 3 4 5 6 
7 8 9 10 11 12
; 

proc print;
run;

 

AndrewHowell
Moderator

A SINGLE trailing "@" holds the input buffer only for the current iteration of the data step (i.e, til processing returns to the top of the data step), or is passed a subsequent INPUT statement without a trailing "@".

 

A DOUBLE trailing "@" holds the input buffer indefinitely (i.e, multiple iterations of the data step) as long as there is data in the input buffer to read.

 

Hope that helps?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 6706 views
  • 4 likes
  • 4 in conversation