conditions in macro

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

conditions in macro

Hi guys,

I keep getting errors of the following code, it says "NOTE: Variable "wherecon1" may not be initialized". Could you help? Thanks!

%let wherecon1=(year>=1993);

%macro applyfilters;

  data db.filtersample;

    set db.fullsample(obs=5);

    where=wherecon1;

  run;

%mend;

%applyfilters;


Accepted Solutions
Solution
‎06-30-2014 04:58 AM
Super User
Super User
Posts: 7,970

Re: conditions in macro

Posted in reply to Kitty_Zhu

Hi,

Your missing the ampersand:

    where=&wherecon1.;

View solution in original post


All Replies
Solution
‎06-30-2014 04:58 AM
Super User
Super User
Posts: 7,970

Re: conditions in macro

Posted in reply to Kitty_Zhu

Hi,

Your missing the ampersand:

    where=&wherecon1.;

New Contributor
Posts: 4

Re: conditions in macro

Ha...yeah...I forgot to add &...Thanks!!!

Occasional Contributor
Posts: 10

Re: conditions in macro

Posted in reply to Kitty_Zhu

Hi,

to take that macro value you need to call that macro by using &

so, where=&wherecon1;

rest is perfect....

🔒 This topic is solved and locked.

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

Discussion stats
  • 3 replies
  • 207 views
  • 0 likes
  • 3 in conversation