When Clause from Macro Variable in Data Step

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

When Clause from Macro Variable in Data Step

Hi,

I have a Macro, which generates multiple when-clause for a select in a Data Step.

For Example:

%let WhenVar = %GenerateWhen(...);

&WhenVar resolves then to something like

when (xy = "abc") output abc;

when (xy = "def") output def;

But when I try to use this Variable in my Data-Step Select Block, it says "Expecting "WHEN", "OTHERWISE", or "END"".

Example:

data abc def;

  set xyz;

  select;

    &WhenVar.;

  end;

run;


Accepted Solutions
Solution
‎06-06-2013 03:27 AM
Occasional Contributor
Posts: 15

Re: When Clause from Macro Variable in Data Step

Okay got it working..

I have to put the whole block in the Variable including "select; end;", then it's working Smiley Happy

View solution in original post


All Replies
Solution
‎06-06-2013 03:27 AM
Occasional Contributor
Posts: 15

Re: When Clause from Macro Variable in Data Step

Okay got it working..

I have to put the whole block in the Variable including "select; end;", then it's working Smiley Happy

🔒 This topic is solved and locked.

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

Discussion stats
  • 1 reply
  • 130 views
  • 0 likes
  • 1 in conversation