Discussion:
Prefix on Means Output Variables
(too old to reply)
Ken Barz
2009-08-12 20:05:15 UTC
Permalink
Hey all, been a while since I've been on the -L due to company email =
problems.

As my brain seems to be on minimal power today, maybe you might help =
with something: I'm trying to streamline some analysis processing =
(using means and freq) to generate one dataset which will have the =
variable name, grouping vars, then n, mean, std, ... However, in =
running proc means using ods output, I notice that n becomes age_n, mean =
becomes age_mean, ... I know I can control that using the output =
statement within the means procedure. Using the ods output approach, is =
there a way to shut off the age_ prefix and just have it read n, mean, =
...?

Thanks,
Ken

%macro analysis (type, ds, clslst, var, addstat);

%if &type =3D cont %then %do;

ods listing close;

ods select Summary(persist);

ods output Summary(persist=3Dproc)=3D&var (drop=3D_proc_ _run_);

proc means data=3D&ds n mean std median min max &addstat;

class &clslst;

var &var;

run;

ods _all_ close;

ods listing;

%end;

%else %if &type =3D cat %then %do;

%end;

data &var;

length variable $8;

set &var;

variable =3D "&var";

run;


%mend;

%analysis(cont, dataout.demogr, cohort treatment, age, )
Tony Yang
2009-08-13 02:47:45 UTC
Permalink
Hi Ken,

It seems you may have to resort to PROC TEMPLATE to customize the output
model for your purpose, however, not sure if it is feasible. Please let us
know if you figure out the concrete solution.

http://support.sas.com/onlinedoc/913/docMainpage.jsp

Thanks.
Tony
Post by Ken Barz
Hey all, been a while since I've been on the -L due to company email
problems.
As my brain seems to be on minimal power today, maybe you might help with
something: I'm trying to streamline some analysis processing (using means
and freq) to generate one dataset which will have the variable name,
grouping vars, then n, mean, std, ... However, in running proc means using
ods output, I notice that n becomes age_n, mean becomes age_mean, ... I
know I can control that using the output statement within the means
procedure. Using the ods output approach, is there a way to shut off the
age_ prefix and just have it read n, mean, ...?
Thanks,
Ken
%macro analysis (type, ds, clslst, var, addstat);
%if &type = cont %then %do;
ods listing close;
ods select Summary(persist);
ods output Summary(persist=proc)=&var (drop=_proc_ _run_);
proc means data=&ds n mean std median min max &addstat;
class &clslst;
var &var;
run;
ods _all_ close;
ods listing;
%end;
%else %if &type = cat %then %do;
%end;
data &var;
length variable $8;
set &var;
variable = "&var";
run;
%mend;
%analysis(cont, dataout.demogr, cohort treatment, age, )
Ken Barz
2009-08-13 20:05:14 UTC
Permalink
Just got some feedback telling me that for some reason they made ods =
output with proc means give you the same thing as a proc means output =
statement with the autoname option. To get it back to "standard" output =
involves two transposes, an extra data step with a scan function and a =
sort.

I'm sorry, if I want autoname, can't I just ask for autoname? I'll add =
this to my list of "things about SAS that drives me up a tree." (or =
maybe to drink. or drinking in a tree, something)
----- Original Message -----=20
From: Tony Yang=20
To: Ken Barz=20
Cc: SAS-***@listserv.uga.edu=20
Sent: Wednesday, August 12, 2009 8:47 PM
Subject: Re: Prefix on Means Output Variables


Hi Ken,

It seems you may have to resort to PROC TEMPLATE to customize the =
output model for your purpose, however, not sure if it is feasible. =
Please let us know if you figure out the concrete solution.

http://support.sas.com/onlinedoc/913/docMainpage.jsp

Thanks.
Tony


On Wed, Aug 12, 2009 at 3:05 PM, Ken Barz <***@comcast.net> wrote:

Hey all, been a while since I've been on the -L due to company email =
problems.

As my brain seems to be on minimal power today, maybe you might help =
with something: I'm trying to streamline some analysis processing =
(using means and freq) to generate one dataset which will have the =
variable name, grouping vars, then n, mean, std, ... However, in =
running proc means using ods output, I notice that n becomes age_n, mean =
becomes age_mean, ... I know I can control that using the output =
statement within the means procedure. Using the ods output approach, is =
there a way to shut off the age_ prefix and just have it read n, mean, =
...?

Thanks,
Ken

%macro analysis (type, ds, clslst, var, addstat);

%if &type =3D cont %then %do;

ods listing close;

ods select Summary(persist);

ods output Summary(persist=3Dproc)=3D&var (drop=3D_proc_ _run_);

proc means data=3D&ds n mean std median min max &addstat;

class &clslst;

var &var;

run;

ods _all_ close;

ods listing;

%end;

%else %if &type =3D cat %then %do;

%end;

data &var;

length variable $8;

set &var;

variable =3D "&var";

run;


%mend;

%analysis(cont, dataout.demogr, cohort treatment, age, )
Data _null_;
2009-08-14 01:51:21 UTC
Permalink
Ken,

When I first read this thread I thought. "why are you using ODS to get
output from proc means?". Seems like the OUTPUT statement is more
flexible and powerful.

Then I read your other post, and I am more confused. Not uncommon for me.

So, the question I have is "what output do you want". Please show
example of input and desired output.
Just got some feedback telling me that for some reason they made ods output with proc means give you the same thing as a proc means output statement with the autoname option. To get it back to "standard" output involves two transposes, an extra data step with a scan function and a sort.
I'm sorry, if I want autoname, can't I just ask for autoname? I'll add this to my list of "things about SAS that drives me up a tree." (or maybe to drink. or drinking in a tree, something)
----- Original Message -----
From: Tony Yang
To: Ken Barz
Sent: Wednesday, August 12, 2009 8:47 PM
Subject: Re: Prefix on Means Output Variables
Hi Ken,
It seems you may have to resort to PROC TEMPLATE to customize the output model for your purpose, however, not sure if it is feasible. Please let us know if you figure out the concrete solution.
http://support.sas.com/onlinedoc/913/docMainpage.jsp
Thanks.
Tony
Hey all, been a while since I've been on the -L due to company email problems.
As my brain seems to be on minimal power today, maybe you might help with something: I'm trying to streamline some analysis processing (using means and freq) to generate one dataset which will have the variable name, grouping vars, then n, mean, std, ... However, in running proc means using ods output, I notice that n becomes age_n, mean becomes age_mean, ... I know I can control that using the output statement within the means procedure. Using the ods output approach, is there a way to shut off the age_ prefix and just have it read n, mean, ...?
Thanks,
Ken
%macro analysis (type, ds, clslst, var, addstat);
%if &type = cont %then %do;
ods listing close;
ods select Summary(persist);
ods output Summary(persist=proc)=&var (drop=_proc_ _run_);
proc means data=&ds n mean std median min max &addstat;
class &clslst;
var &var;
run;
ods _all_ close;
ods listing;
%end;
%else %if &type = cat %then %do;
%end;
data &var;
length variable $8;
set &var;
variable = "&var";
run;
%mend;
%analysis(cont, dataout.demogr, cohort treatment, age, )
Nathaniel Wooding
2009-08-14 12:10:47 UTC
Permalink
Ken

I have not gotten in the habit of using autoname so I cannot help but let me suggest that you look on Andrew Karp's site for his papers on proc means. I have seen at least one of these and as I recall, he included material on autoname. Try the site

http://www.sierrainformation.com/html/past_presentations_list.php

As I recall, he has first-time viewers log in so if this does now work properly, use the first part of the url and look for his free downloads link.

Nat Wooding

-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-***@LISTSERV.UGA.EDU] On Behalf Of Ken Barz
Sent: Thursday, August 13, 2009 4:05 PM
To: SAS-***@LISTSERV.UGA.EDU
Subject: Re: Prefix on Means Output Variables

Just got some feedback telling me that for some reason they made ods output with proc means give you the same thing as a proc means output statement with the autoname option. To get it back to "standard" output involves two transposes, an extra data step with a scan function and a sort.

I'm sorry, if I want autoname, can't I just ask for autoname? I'll add this to my list of "things about SAS that drives me up a tree." (or maybe to drink. or drinking in a tree, something)
----- Original Message -----
From: Tony Yang
To: Ken Barz
Cc: SAS-***@listserv.uga.edu
Sent: Wednesday, August 12, 2009 8:47 PM
Subject: Re: Prefix on Means Output Variables


Hi Ken,

It seems you may have to resort to PROC TEMPLATE to customize the output model for your purpose, however, not sure if it is feasible. Please let us know if you figure out the concrete solution.

http://support.sas.com/onlinedoc/913/docMainpage.jsp

Thanks.
Tony


On Wed, Aug 12, 2009 at 3:05 PM, Ken Barz <***@comcast.net> wrote:

Hey all, been a while since I've been on the -L due to company email problems.

As my brain seems to be on minimal power today, maybe you might help with something: I'm trying to streamline some analysis processing (using means and freq) to generate one dataset which will have the variable name, grouping vars, then n, mean, std, ... However, in running proc means using ods output, I notice that n becomes age_n, mean becomes age_mean, ... I know I can control that using the output statement within the means procedure. Using the ods output approach, is there a way to shut off the age_ prefix and just have it read n, mean, ...?

Thanks,
Ken

%macro analysis (type, ds, clslst, var, addstat);

%if &type = cont %then %do;

ods listing close;

ods select Summary(persist);

ods output Summary(persist=proc)=&var (drop=_proc_ _run_);

proc means data=&ds n mean std median min max &addstat;

class &clslst;

var &var;

run;

ods _all_ close;

ods listing;

%end;

%else %if &type = cat %then %do;

%end;

data &var;

length variable $8;

set &var;

variable = "&var";

run;


%mend;

%analysis(cont, dataout.demogr, cohort treatment, age, )
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.

Continue reading on narkive:
Loading...