|
If think you want to change the macro to a single call not just hack
together some way to call it multiple times.
First, you have two parameters LABEL and FORMAT that SAS already has
statements for. You want to used that to your advantage. You can
have parameters for these but they should have the same syntax as the
SAS statements and will have defaults that are blank. Your macro will
use the formats and labels that are already attached to the variable
and these parameters will serve as a way to change these values when
the macro is called.
I would call the parameter TABLE, DATA but that is a small thing.
That leaves how to tell the macro the information you have specified
as TYPE= and the names of these variables. I would use DISCRETE and
CONTINUOUS or something along those lines. Discrete variables are
counted and continuous variables are summarized with descriptive
statistics like (n mean std min max). Using this type of
parametrization you can add specialized types, perhaps were the values
are both counted and summarized as continuous.
You may want a parameter to define a list of summary statistics to be
calculated and perhaps some way to communicate the number of
additional decimal places, if any to use when the those values are
displayed. Also you may want to provide options for how the counts
and percentages are displayed. You may need others parameters as
well. Like a BY variables list parameter and a parameter to describe
the columns of the table.
This is how I would change the parametrization, for what you have presented.
%macro
demo
(
data = , /* input data set */
by = , /* grouping variables */
treatment = , /* probably the column variable */
continuous = , /* list of continuous variables */
discrete = , /* list of discrete variables */
label = , /* labels, same format as SAS LABEL statement */
format = /* formats, same format as SAS FORMAT statement */
)
;
%put _local_;
%mend demo;
And example call might look like...
%demo
(
data = one,
treatment = trtcd,
discrete = gender,
continuous = age weight height duration,
format = trtcd trt. gender sex. weight f6.1 height f3. duration f3.,
label = gender ='Gender(%)'
age ='Age (Yrs.)'
weight ='Body weight (Kg)'
Height ='Height (cm)'
duration='Mean Duration of asthma (years)'
)
On 4/11/06, Madan Gopal Kundu <Madan.Kundu@ranbaxy.com> wrote:
> Hi SAS-users,
>
>
>
> I have written macro %demo. It will produce demographic table for each
> variable. Suppose, if our dataset is one and demographic variable in
> this table are gender, age, weight, height and duration then I have to
> run macro for each variable separately as follows.
>
>
>
> %demo(table=one, var=gender , type=2, label=Gender(%), format=sex)
>
>
>
> %demo(table=one, var=age, type=1, label=Age (Yrs.), format=)
>
>
>
> %demo(table=one, var=weight, type=1, label=Body weight (Kg), format=)
>
>
>
> %demo(table=one, var=Height, type=1, label=Height (cm), format=)
>
>
>
> %demo(table=one, var=duration, type=1, label=Mean Duration of asthma
> (years), format=);
>
>
>
> Can it be possible so that I have to run only once the macro %demo and I
> will get all the tables? I think it is. If so then what arguments I have
> to sent to this macro %demo and how?
>
>
>
> Please reply.
>
>
>
> With regards,
>
> Madan Gopal Kundu
>
>
>
> (i) The information contained in this e-mail message is intended only for the confidential use of the recipient(s) named above. This message is privileged and confidential. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message.
>
>
> (ii) The sender confirms that Ranbaxy shall not be responsible if this email message is used for any indecent, unsolicited or illegal purposes, which are in violation of any existing laws and the same shall solely be the responsibility of the sender and that Ranbaxy shall at all times be indemnified of any civil and/ or criminal liabilities or consequences there.
>
|