Date: Wed, 27 Feb 2008 09:04:42 -0800
Reply-To: drraju123@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: drraju123@GMAIL.COM
Organization: http://groups.google.com
Subject: proc report - automation
Content-Type: text/plain; charset=ISO-8859-1
Hi all,
how are you doing.
i am using a macro to create 'aa' dataset. each call of
macro produces
aa dataset with different number of variables depending on wether it
is for sex or area (which is put in a macro parameter).
for every variable:
example : p1n_0_1 the value between _ _ is treatment ( 0 )
the last value is the code for sex
or area( 1 )
lets say:
label 0 = 'x'
1 = ' y'
2 = 'z'
the treatments will be same for either sex or area.
sex code 1 = male
2 = female
area code 1 = nc
2 =ny
3 = mi
4 = tx
i want to write a proc report such that when i call macro depending on
the macro parameter
the output should be created.
lets say %macro x(var = );
proc report;
%mend;
%x (var = sex);
%x(var = area);
for sex output shpuld be:
______X_______
_______Y_________ __________Z_______
SOC MPT MALE FEMALE MALE FEMALE
MALE FEMALE
N(%) N(%)
N(%) N(%) N(%) N(%)
Blood anaemia 33(12.0) 44(11.0) 32(23.0)
56(80.0) 45(10.0) 54(56.0)
for area.
it will be same as sex except instead of male and female we have nc ny
mi tx under each treatment
please see below for datasets
data aa; /** datset for sex**/
input soc $ mpt $ p1n_0_1 $ p1n_0_2 $ p1n_1_1 $ p1n_1_2 $ p1n_2_1 $
p1n_2_2 $;
datalines;
blood anaemia 33(12.0) 44(11.0) 32(23.0) 56(80.0) 45(10.0) 54(56.0)
;
run;
data aa; /** datset for area**/
input soc $ mpt $ p1n_0_1 $ p1n_0_2 $ p1n_0_3 $ p1n_0_4 $
p1n_1_1 $ p1n_1_2 $ p1n_1_3 $ p1n_1_4 $
p1n_2_1 $ p1n_2_2 $ p1n_2_3 $ p1n_2_4 $ ;
datalines;
blood anaemia 33(12.0) 44(11.0) 32(23.0) 56(80.0)
45(10.0) 54(56.0) 33(12.0) 44(11.0)
32(23.0) 56(80.0) 33(12.0) 44(11.0)
;
run;
thank you,
Rangoon.