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)
For my ae dataset, proc transpose I got C0, C1 and C2. But in class, you got only C0 and C1 only
proc sort data = ae out = aedecod (keep = usubjid aebodsys aedecod trt01pn) nodupkey;
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 ;