Hi:
Ah, yes, my bad. I didn't run into that issue with "INVENTORY" as the variable. So, the error comes from the &score._min, etc -- which means you have to use the statistic names in the OUT=. For more complicated logic, you might need a macro program or you just might need a datastep to rename your variables before the tabulate runs, so you have more reliable (and smaller) variable names.
cynthia
My (partial) output:
[pre]
decileout2 -- substring method
supercalifragilistic_ supercalifragilistic_ supercalifragilistic_
Obs Product _TYPE_ _PAGE_ _TABLE_ min mean max
1 Boot 1 1 1 374 187012.90 882080
2 Men's Casual 1 1 1 2176 379672.29 2881005
3 Men's Dress 1 1 1 538 290146.80 1847559
[/pre]
My revised code:
[pre]
options nodate nonumber nocenter ls=180;
data testdata;
set sashelp.shoes;
supercalifragilisticexpeialidoci = inventory;
run;
%let score = supercalifragilisticexpeialidoci;
%let new = %substr(&score,1,20);
proc tabulate data=testdata
out=DecileOut2(rename=(min=&new._min
mean=&new._mean
max=&new._max));
class region product;
var &score ;
table product='' all,
&score*(min mean max);
run;
proc print data=DecileOut2;
title 'decileout2 -- substring method';
run;
[/pre]
Alternative -- just rename long variable and then you don't have to worry about it. You'd now use &NEW in the TABULATE step without having to do a RENAME in TABULATE:
[pre]
%let score = supercalifragilisticexpeialidoci;
%let new = %substr(&score,1,20);
data alt;
set testdata(rename=(&score=&new));
run;
proc tabulate data=alt
out=DecileOut3;
class region product;
var &new ;
table product='' all,
&new*(min mean max);
run;
proc print data=DecileOut3 ;
title 'decileout3 different';
run;
[/pre]