BookmarkSubscribeRSS Feed
sas1981
Calcite | Level 5

I have some code below with the @ sign that devides the data set into two datasets; first and second (using the @ sign):

 

data first second;
INPUT x y @;
OUTPUT first;
INPUT x y;
OUTPUT second;
DATALINES;
1 2 3 4 9 10
5 6 7 8
;
PROC PRINT data=first;
Title 'first';
RUN;
PROC PRINT data=second;
Title 'second';
RUN;

 

When I replace the @ sign with @@ I am getting the same result but I was assuming I would not. I am wondering why the two different code produce the same output. Thank you for any advise. 

1 REPLY 1
art297
Opal | Level 21

You defeat the functionality of @ and @@ by including two input statements. Try the following:

data first_a second_a;
  INPUT x y @;
  if mod(_n_,2) then OUTPUT first_a;
  else OUTPUT second_a;
  DATALINES;
1 2 3 4 5 6
7 8 9 10 11 12
;

data first_b second_b;
  INPUT x y @@;
  if mod(_n_,2) then OUTPUT first_b;
  else OUTPUT second_b;
  DATALINES;
1 2 3 4 5 6
7 8 9 10 11 12
;

Art, CEO, AnalystFinder.com

 

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 connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 647 views
  • 1 like
  • 2 in conversation