For my ae dataset, proc transpose I got C0, C1 and C2. But in class, you got only C0 and C1 only.Please explain about this

10 views
Skip to first unread message

Thirumagal manivannan

unread,
Sep 18, 2014, 5:47:08 PM9/18/14
to anova...@googlegroups.com
Hi Vikas,
I am practicing with AE dataset.
/*
 1) Get the count for number of patients in each treatment group = PT_TRT ( 2 observation and 2 variables)
 2) Sort alln with trt01pn
 3) Merge dataset in step 1 with step 2 by trt01pn
 4) calculate n(%)
 5) transpose n(%) variable
*/

For my ae dataset, proc transpose I got C0, C1 and C2. But in class, you got only C0 and C1 only

my code

proc sort data = ae out = pt (keep = USUBJID) nodupkey;
by USUBJID;
run;

data pt_trt;
set pt;
random = ranuni(0);
if random <= 0.5 then trt01pn = 1;
else trt01pn = 0;
drop random;
run;
libname aetrt "/folders/myshortcuts/batch5/homework/vgaddu";
data aetrt.ae_trt;
merge ae pt_trt;
by USUBJID;
run;
data ae;
 set aetrt.ae_Trt;
run;

proc sort data = ae out = aebodsys (keep = usubjid aebodsys trt01pn) nodupkey;
 by trt01pn aebodsys usubjid ;
run;

proc summary data = aebodsys nway;
class aebodsys trt01pn;
output out = nbody (drop = _type_);
run;


proc sort data = ae out = aedecod (keep = usubjid aebodsys aedecod trt01pn) nodupkey;
 by trt01pn aebodsys aedecod usubjid ;
run;

proc summary data = aedecod nway;
class aebodsys aedecod trt01pn;
output out = ndecod (drop = _type_) ;
run;

data alln;
 set nbody ndecod;
run;

proc sort data = alln;
 by aebodsys aedecod;
run;
proc transpose data = alln out = talln prefix = c;
by aebodsys aedecod;
id trt01pn;
var _freq_;
run;
proc print data = talln;
run;
log result
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
43 ;
44 proc sort data = ae out = pt (keep = USUBJID) nodupkey;
45 by USUBJID;
46 run;
NOTE: There were 195 observations read from the data set WORK.AE.
NOTE: 172 observations with duplicate key values were deleted.
NOTE: The data set WORK.PT has 23 observations and 1 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.02 seconds
47
48 data pt_trt;
49 set pt;
50 random = ranuni(0);
51 if random <= 0.5 then trt01pn = 1;
52 else trt01pn = 0;
53 drop random;
54 run;
NOTE: There were 23 observations read from the data set WORK.PT.
NOTE: The data set WORK.PT_TRT has 23 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.02 seconds
55 libname aetrt "/folders/myshortcuts/batch5/homework/vgaddu";
NOTE: Libref AETRT was successfully assigned as follows:
Engine: V9
Physical Name: /folders/myshortcuts/batch5/homework/vgaddu
56 data aetrt.ae_trt;
57 merge ae pt_trt;
58 by USUBJID;
59 run;
NOTE: There were 195 observations read from the data set WORK.AE.
NOTE: There were 23 observations read from the data set WORK.PT_TRT.
NOTE: The data set AETRT.AE_TRT has 195 observations and 11 variables.
NOTE: DATA statement used (Total process time):
real time 0.09 seconds
cpu time 0.05 seconds
60 data ae;
61 set aetrt.ae_Trt;
62 run;
NOTE: There were 195 observations read from the data set AETRT.AE_TRT.
NOTE: The data set WORK.AE has 195 observations and 11 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
63
64 proc sort data = ae out = aebodsys (keep = usubjid aebodsys trt01pn) nodupkey;
65 by trt01pn aebodsys usubjid ;
66 run;
NOTE: There were 195 observations read from the data set WORK.AE.
NOTE: 72 observations with duplicate key values were deleted.
NOTE: The data set WORK.AEBODSYS has 123 observations and 3 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.02 seconds
cpu time 0.02 seconds
67
68 proc summary data = aebodsys nway;
69 class aebodsys trt01pn;
70 output out = nbody (drop = _type_);
71 run;
NOTE: There were 123 observations read from the data set WORK.AEBODSYS.
NOTE: The data set WORK.NBODY has 42 observations and 3 variables.
NOTE: PROCEDURE SUMMARY used (Total process time):
real time 0.05 seconds
cpu time 0.06 seconds
72
73
74 proc sort data = ae out = aedecod (keep = usubjid aebodsys aedecod trt01pn) nodupkey;
75 by trt01pn aebodsys aedecod usubjid ;
76 run;
NOTE: There were 195 observations read from the data set WORK.AE.
NOTE: 29 observations with duplicate key values were deleted.
NOTE: The data set WORK.AEDECOD has 166 observations and 4 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.03 seconds
cpu time 0.04 seconds
77
78 proc summary data = aedecod nway;
79 class aebodsys aedecod trt01pn;
80 output out = ndecod (drop = _type_) ;
81 run;
NOTE: There were 166 observations read from the data set WORK.AEDECOD.
NOTE: The data set WORK.NDECOD has 132 observations and 4 variables.
NOTE: PROCEDURE SUMMARY used (Total process time):
real time 0.03 seconds
cpu time 0.04 seconds
82
83 data alln;
84 set nbody ndecod;
85 run;
NOTE: There were 42 observations read from the data set WORK.NBODY.
NOTE: There were 132 observations read from the data set WORK.NDECOD.
NOTE: The data set WORK.ALLN has 174 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.02 seconds
86
87 proc sort data = alln;
88 by aebodsys aedecod;
89 run;
NOTE: There were 174 observations read from the data set WORK.ALLN.
NOTE: The data set WORK.ALLN has 174 observations and 4 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.02 seconds
90 proc transpose data = alln out = talln prefix = c;
91 by aebodsys aedecod;
92 id trt01pn;
93 var _freq_;
94 run;
NOTE: There were 174 observations read from the data set WORK.ALLN.
NOTE: The data set WORK.TALLN has 121 observations and 6 variables.
NOTE: PROCEDURE TRANSPOSE used (Total process time):
real time 0.02 seconds
cpu time 0.03 seconds
95 proc print data = talln;
96 run;
NOTE: There were 121 observations read from the data set WORK.TALLN.
NOTE: The PROCEDURE PRINT printed pages 42-44.
NOTE: PROCEDURE PRINT used (Total process time):
real time 1.53 seconds
cpu time 1.57 seconds
97 ;
98 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
108 ;

proc transpose c0,c1 and c2 are displayed.docx

Anova Groups

unread,
Sep 24, 2014, 5:36:55 PM9/24/14
to anova...@googlegroups.com
Look at your input dataset and see why you are getting three values for treatment variable. I don't think you need to create treatment assignment again in your code. I had already done it in my ae dataset.
Reply all
Reply to author
Forward
0 new messages