Michael A
Michael A

Reputation: 4613

How do I escape an underscore that follows a macro name?

I'm writing some proc sql code like this

%let psample = 10;
proc sql;
    create table mylib.matches_&psample_some_suffix as
    select ...

but SAS gives me the warning

WARNING: Apparent symbolic reference PSAMPLE_SOME_SUFFIX not resolved.

How do I make SAS understand that the macro name stops with psample and not `psample_some_suffix'? For readability, I want these underscores in my file name.

Upvotes: 1

Views: 605

Answers (1)

Quentin
Quentin

Reputation: 6378

Use a dot to explicitly end the macro variable reference:

mylib.matches_&psample._some_suffix 

Upvotes: 2

Related Questions