[ESS] SAS Indentation
Cameron Hooper
chooper at umich.edu
Wed Oct 26 23:09:20 CEST 2005
Some of the ESS indentation rules for SAS are not, in my opinion,
ideal. I realise this is very much a question of personal taste, but I
would like to raise the issue for discussion anyway. If this has been
discussed to death earlier, please accept my apologies in advance. Here
are a series of examples. In each case I believe my preferred
indentation is closer to that used in the SAS documentation and in many
books produced by the SAS institute.
* ESS produces;
data tmp;
set tmp;
do i = 1 to 10;
x = i;
end; /* end not aligned with beginning of do block */
run;
* I would prefer;
data tmp;
set tmp;
do i = 1 to 10;
x = i;
end;
run;
* ESS produces;
data tmp;
set tmp;
if x = 1 then
do;
y = 2;
z = x;
end; /* end aligned with do, but blocked statements not
indented */
run;
* I would prefer;
data tmp;
set tmp;
if x = 1 then
do;
y = 2;
z = x;
end;
run;
* OR;
data tmp;
set tmp;
if x = 1 then do;
y = 2;
z = x;
end;
* ESS gives;
data tmp;
set tmp;
select (x);
when (1) y = 2; /* No indentation at all */
when (2) z = z;
otherwise put "Stuff";
end;
run;
* I would prefer;
data tmp;
set tmp;
select (x);
when (1) y = 2;
when (2) z = z;
otherwise put "Stuff";
end;
run;
* ESS gives;
data tmp;
input z y z;
datalines;
45 78 23
22 55 88 /* Inconsistent indentation */
12 83 90
;
run;
* I would prefer;
data tmp;
input z y z;
datalines;
45 78 23
22 55 88
12 83 90
;
run;
* or;
data tmp;
input z y z;
datalines;
45 78 23
22 55 88
12 83 90
;
run;
Cameron
More information about the ESS-help
mailing list