SAS Macro, passing value as string to where clause

后端 未结 1 1681
滥情空心
滥情空心 2021-01-20 15:55

I have a SAS macro below that is not working--- this snippet returns no values because the where statement doesn\'t work. Anyone have any ideas? I tried adding %str but that

相关标签:
1条回答
  • 2021-01-20 16:28

    Macro variables will not resolve in single quotes. You are also missing the FROM clause, and the macro parameter was being provided as positional (instead of name=value pair). Try the following:

    %macro refreshments(beverage_type=);
      proc sql;
      select * 
        from YOURTABLE
        where drink_type = "&beverage_type";
    %mend;
    
    %refreshments(beverage_type=Sprite);
    
    0 讨论(0)
提交回复
热议问题