DATA Step, Macro, Functions and more

What is the functionality of || here

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 131
Accepted Solution

What is the functionality of || here

%macro break(byval);
  data work.age_&byval;
    set work.sorted(where=(age=&byval));
  run;
%mend;
proc sort data=sashelp.class out=work.sorted;
  by age;
run;
options mprint;
data _null_;
  set work.sorted;
  by age;
  if first.age then call execute('%break('||age||')');
run;


Accepted Solutions
Solution
‎02-16-2012 11:20 AM
PROC Star
Posts: 7,363

What is the functionality of || here


All Replies
PROC Star
Posts: 7,363

What is the functionality of || here

concatenation

Frequent Contributor
Posts: 131

What is the functionality of || here

Sorry I don't understand why there is concatenation here. The files are produced as age_11, age_12...

PROC Star
Posts: 7,363

What is the functionality of || here

It is concatenating the string that is being sent.  In short, it is submitting:

%break(16)

which will run the macro with the variable's value


Frequent Contributor
Posts: 131

What is the functionality of || here

Can I ask how '||age||' became the value of the variable?

Thanks for help.

Solution
‎02-16-2012 11:20 AM
PROC Star
Posts: 7,363

What is the functionality of || here

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 164 views
  • 0 likes
  • 2 in conversation