I was going through a SAS code and found the following ways of referencing a macro variable.
I know that the first way of referencing is the normal way of how we refer to a defined macro variable in sas.
But, could you please explain how does the second way(without period after the macro variable name) is different from the first way
It is the short way to reference a variable. However it makes a difference when concatenating output:
%let var = My name ;
%put &var.is Paul;
// Output: My name is Paul.
%put &varis Paul;
// Output: WARNING: Apparent symbolic reference VARIS not resolved.
// &varis Paul
Another example where you definitely need a .
:
%let lib = sashelp;
data temp;
set &lib..class;
run;
I would recommend to always use the variant &variable.
. Because it is clear where the variable ends.