DATA Step, Macro, Functions and more

Macro quoted string syntax (consecutive commas)

Accepted Solution Solved
Reply
Regular Learner
Posts: 1
Accepted Solution

Macro quoted string syntax (consecutive commas)

What is the function of the double commas (,,) in the code below?

 

data dm6a;
    set rawdata.dob rawdata.xds(where=(datc^=''));
    length pendtc $19.;
    if datc^= '' then do; %dtc(datc,,pendtc); end;
    else if visdatc ^= '' then do; %dtc(visdatc,,pendtc); end;
    else do; %dtc(visdatc,,pendtc); end;
run;


Accepted Solutions
Solution
a month ago
Super User
Posts: 6,939

Re: Macro quoted string syntax (consecutive commas)

[ Edited ]

The commas indicate that when %DTC was defined, it was designed to hold three parameters.  When calling the macro, the values supplied are:

 

1st parameter = datc (or visdatc)

 

2nd parameter = (null string)

 

3rd parameter = pendtc

 

The extra comma holds the parameters in place.  Without it, macro language would think that the second parameter should be pendtc

View solution in original post


All Replies
Solution
a month ago
Super User
Posts: 6,939

Re: Macro quoted string syntax (consecutive commas)

[ Edited ]

The commas indicate that when %DTC was defined, it was designed to hold three parameters.  When calling the macro, the values supplied are:

 

1st parameter = datc (or visdatc)

 

2nd parameter = (null string)

 

3rd parameter = pendtc

 

The extra comma holds the parameters in place.  Without it, macro language would think that the second parameter should be pendtc

☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 60 views
  • 0 likes
  • 2 in conversation