0

I want to what does the .(dot) meant in the following sas line statement: (line &ls.*"_";) I know the ls is a macro variable but what does the dot mean?

option pageno=1 nodate center;
  %let ls=68;
  %let ps=20;

proc report data=class2 LS=&ls PS=&ps SPLIT="/" center headline headskip  nowd spacing=5 out=outdata1;

column sex age name height weight notdone;
define sex / order order=internal descending width=6 LEFT noprint;
define age / order order=internal width=3 spacing=0 "age" right;
define name / display width=8 left "name" flow;
define height / sum width=11 right "height";
define weight / sum width=11 right "weight";
define notdone / sum format= notdone. width=15 left "status";

computer before;
 nd=notdone.sum;
endcomp;
compute before _page_/left;
  line "gender group: " sex $gender.;
  line &ls.*"_";
  line ' ';
endcomp;
pnuts
  • 58,317
  • 11
  • 87
  • 139
Anne Ortiz
  • 133
  • 1
  • 1
  • 5

1 Answers1

4

The period delimits the end of a macro variable name. Often, this isn't necessary as SAS will recognize the end of a macro variable name as soon as is sees a character that is not valid in a SAS name (e.g. space, semicolon). Most importantly, the period allows you to tell SAS the end of the macro variable name if it's in the middle of a string.

%let mv=var;
%put &mv.3;

returns var3 to the log, whereas &mv3 would fail to resolve without there being a macro variable named mv3 defined.

Also, realize that the delimiting period is not contained in the resolved code. e.g:

%let lib=sashelp;

data cars;
  set &lib..cars;
run;

The set statement after resolving the macro variable is

  set sashelp.cars;
DWal
  • 2,752
  • 10
  • 19
  • I also find it useful to write the `.` because it can trick the editor into thinking you're referencing a format, which then highlights the variable grey so it's easier to spot :) – Stu Sztukowski Sep 23 '15 at 15:13
  • @StuSztukowski I find the opposite. I guess it's a matter of taste, but I find all the extra periods appear as clutter to me. Kind of like adding lots of parentheses that aren't required. – Robert Penridge Sep 23 '15 at 15:56