Nate
Nate

Reputation: 420

Proc means prefix?

Minor question, but if we have the following:

proc means data = have;
class &ind_vars.;
var &dep_vars.;
output out = want sum = ;

Ideally I would like to rename the output of the sums of all the dependent variables, to something like n_[dependent var goes here], which is to say I'd like to just add a prefix indicating that these variables represent sums. However, using the sum=[name] just changes all the vars to have that name, not add a prefix.

Any way to do this within the proc means itself? I'm aware that I could do it very easily in a separate step...(or even rename all the dependent vars to sum_dependent_var in a view beforehand), but I figure there might be a built-in option for something that I'm sure many people want to do.

Upvotes: 2

Views: 2116

Answers (1)

Joe
Joe

Reputation: 63434

If you add /autoname to the output statement, it will automatically make all the names [stat]_[var]. That sounds about like what you're asking for.

proc means data=sashelp.class;
var age height weight;
output out=blah n= sum= /autoname;
run;

Upvotes: 2

Related Questions