If by 'original name' you mean the name assigned by you then code the output statement somewhat like
The procedure will name the stats with original names when you use stat= with no variable names following. However when you want two statistics you will end up needing autoname, and you're right back where you started.
I prefer the arrangement of the default data set but you can only get a few statistics and SUM ain't one of them. You might try this.
proc means noprint data=sashelp.class;
output out=sum sum=;
output out=n n=;
set sum(in=in1) n(in=in2);
by _type_ sex;
length _STAT_ $8;
when(in1) _stat_ ='SUM';
when(in2) _stat_ ='N';
proc print data=stats;
your OUTPUT statement requested statistics SUM and N. My output window from PROC MEANS didn't show the N statistic because you put SUM in the proc means statement but not N, so I'm a little confused which is what you wanted.
So with nothing else to go on, I'll assume both.
I generated this test data[pre]data _9SSummary ;
do _1 = 1 to 3 ;
do _2 = 2 to 4 by 2 ;
do _3 = 3 to 9 by 3 ;
_4= (_1*10 +_2 )*10 +_3 ;
if not mod( _4, 7 ) then _4=. ; ;
end; end; end;
run ;[/pre]***** I wanted to have an analysis variable occasionally missing;
When you need only one statistic (say, SUM), PROC MEANS is your best friend
proc means data= _9SSummary nway ;
var _: ;
output sum= out= _9SSummaryA( drop= _type_ _freq_ ) ;
Then PROC MEANS assumes that the statistics should be named like the original variables from which they are derived.
You can even leave out that VAR statement and PROC MEANS will provide the statistics for all numeric variables when that is what you need.
There is another excellent feature in PROC MEANS ----> more than one OUTPUT statement can be used.
So, if you really needed two statistics - create a separate output for each stat.
OUTPUT OUT= stat1 SUM= ;
OUTPUT OUT= stat2 N= ;
Of course you will want to bring the results back together again - how about[pre]proc means data=_9SSummary n sum maxdec= 0;
var _: ;
output out=_9SSummaryS sum= ;
output out=_9SSummaryN n= ;
data together ;
set _9SSummaryN(in= stat2)
_9SSummaryS(in= stat1) ;
drop _type_ _freq_ ;
if stat1 then _stat_ = 'SUM' ;else _stat_ ='N' ;
proc transpose out= _9SSummaryA( rename= _name_= Variable) ;
id _stat_ ;
proc print ;
run ; [/pre]From my brief test data, I got this listing[pre]
Obs Variable N SUM
1 _1 18 36
2 _2 18 54
3 _3 18 108
4 _4 15 3450
So Charles, what was it you wanted?
looks like I type too slowly ! data _null_; seems to have made my suggestions redundant ;-(