BookmarkSubscribeRSS Feed
GeorgeSAS
Lapis Lazuli | Level 10

Hello all,

 

Would  anyone can please give me an example of how to using '@@' in a data _null_; file  example?

 

Thanks!

1 REPLY 1
FreelanceReinh
Jade | Level 19

Hello @GeorgeSAS,

 

The double trailing @ line-hold specifier is mostly used with an INPUT statement, as in Example 4 of the documentation (please see explanations there). If you insist on an example with data _null_ (and a FILE statement?), here's an adapted version:

data _null_;
file print;
input name $ age @@;
put name age;
datalines;
John 13 Monica 12 Sue 15 Stephen 10
Marc 22 Lily 17
;

 

Line-hold specifiers can also be used with a PUT statement. In this case, however, the single and double trailing @ are equivalent, so that writing "@@" is unnecessary (again, please see documentation, esp. example 5 there). Here is another example (including a FILE statement):

data _null_;
file print;
length c $11;
do c='first', 'line', 'second', 'line', repeat('-',10);
  put c @;
  if c='line' then put;
end;
run;

The second PUT statement (called "null PUT statement" in the documentation) releases the output line so that the intended line breaks occur.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 763 views
  • 3 likes
  • 2 in conversation