0
votes

In SAS I have a simple proc SQL statement in which I will control table to get data from by a predefined variable.

I want to keep the 'Data sorurce' and 'Initial Catalog' catalog fixed and define it in my proc sql but I want to declare the table beforehand.

In my code below I want to predefine where the '*' are

proc sql;
   ...
   select ...
   From *
    ...
quit;

I have tried the following wothout luck:

%let sqltable = "[my_table]";

proc sql;
   ...
   select ...
   From &sqltable.
    ...
quit;
1

1 Answers

3
votes

Unless absolutely necessary, don't quote your macro variables; if you need quotes, quote them when you resolve them. In this case, you don't need quotes at all.

%let sqltable = [my_table];

proc sql;
   ...
   select ...
   From &sqltable.
    ...
quit;