-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutl-reduce-your-sdtm-and-adam-mapping-effort-using-a-common-meta-data-model.sas
More file actions
2036 lines (1842 loc) · 165 KB
/
utl-reduce-your-sdtm-and-adam-mapping-effort-using-a-common-meta-data-model.sas
File metadata and controls
2036 lines (1842 loc) · 165 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%let pgm=utl-reduce-your-sdtm-and-adam-mapping-effort-using-a-common-meta-data-model;
/************************************************************************************************************************************************/
/* */
*; %let pgm=clx_010mta; *;
/* */
/* Program location: d:/clx/sas/clx_010mta.sas */
/* */
/* %let purpose =Create a common meta data model to reduce the mapping efforts; */
/* _ */
/* _ __ ___ __ _ __| |_ __ ___ ___ */
/* | `__/ _ \/ _` |/ _` | `_ ` _ \ / _ \ */
/* | | | __/ (_| | (_| | | | | | | __/ */
/* |_| \___|\__,_|\__,_|_| |_| |_|\___| */
/* */
/* 1. Download all the externals */
/* Create a folder for this project, I suggest d:/clx or any other drive:/clx */
/* */
/* 2. Download clz.zip and extract the external inputs into the folder you created in step 1. */
/* */
/* 3. Copy program c:/clx/sas/clx_010mta.sas into your editor (or use this readme or .sas version) */
/* */
/* 4. You should be able to run the entire program, but I suggest you highlight and run blocks of code */
/* */
/* I hope I got all the dependncies on d:/clx */
/* */
/* github */
/* https://tinyurl.com/2p8jjrdt */
/* https://github.com/rogerjdeangelis/utl-reduce-your-sdtm-and-adam-mapping-effort-using-a-common-meta-data-model */
/* */
/* Related to */
/* https://tinyurl.com/2zps56xc */
/* https://github.com/rogerjdeangelis/utl-end-to-end-cdisc-SDTM-ADaM-processing */
/* */
/* */
/************************************************************************************************************************************************/
/* */
/* Description */
/* */
/* Common Meta Data Model(CMDM) mines all previous mapping work to locate reusable mapping code, create excel meta sheeta and, make define.xml */
/* */
/* It is like the define.xml on steroids */
/* */
/* Can create the excel meta workbooks and define.xml directly from the CMDM. */
/* */
/* This is a simplified CMDM, the full model can do things like identify unmapped raw variables. Also has all the promary keys for all tables. */
/* */
/* Full CMDM has Dimension tables with CRF, SAP, PROTOCOL, SDTM IG, SDTM Guidance, SDTM contrlled terminology */
/* */
/* I have some AI to do thinks like capture mappings from annotated CRFs */
/* */
/************************************************************************************************************************************************/
/* _ _ _ */
/* __| | ___ _ __ ___ _ __ __| | ___ _ __ ___(_) ___ ___ */
/* / _` |/ _ \ `_ \ / _ \ `_ \ / _` |/ _ \ `_ \ / __| |/ _ \/ __| */
/* | (_| | __/ |_) | __/ | | | (_| | __/ | | | (__| | __/\__ \ */
/* \__,_|\___| .__/ \___|_| |_|\__,_|\___|_| |_|\___|_|\___||___/ */
/* |_| */
/* */
/* Win 10 pro workstation 64bit */
/* SAS 9.4 M7 64bit */
/* */
/* EXTERNAL MACROS ALL OF THESE ARE IN AUTOCALL FOLDER D:/CLS/OTO */
/* =============================================================== */
/* */
/* utlnopts - turn options off to minimize the log */
/* utlopts - turn options on for debugginf */
/* */
/* utl_optlenpos - seet valable length to the max observed */
/* */
/* utl_dirlst - create sas data set will all files in a folder */
/* */
/* ods_off - turn ods off */
/* ods_on - turn ods on */
/* */
/* stop_submission - gently stops SAS processing */ */
/* */
/* */
/* INTERNAL MACROS ALL OF THESE ARE IN AUTOCALL FOLDER D:/CLS/OTO */
/* =============================================================== */
/* */
/* NONE */
/* */
/* VERSION FOLDER */
/* */
/* c:/ver/clx_010mta#timestamp* */
/* */
/************************************************************************************************************************************************/
/* */
/* _ _ _ _ _ _ */
/* (_)_ __ _ __ _ _| |_ _ __ _ __ _____ _(_) ___ _ _ ___ _ __ ___ __ _ _ __ _ __ ___ __| | __| | __ _| |_ __ _ */
/* | | `_ \| `_ \| | | | __| | `_ \| `__/ _ \ \ / / |/ _ \| | | / __| | `_ ` _ \ / _` | `_ \| `_ \ / _ \/ _` | / _` |/ _` | __/ _` | */
/* | | | | | |_) | |_| | |_ | |_) | | | __/\ V /| | (_) | |_| \__ \ | | | | | | (_| | |_) | |_) | __/ (_| | | (_| | (_| | || (_| | */
/* |_|_| |_| .__/ \__,_|\__| | .__/|_| \___| \_/ |_|\___/ \__,_|___/ |_| |_| |_|\__,_| .__/| .__/ \___|\__,_| \__,_|\__,_|\__\__,_| */
/* |_| |_| |_| |_| */
/* _ _ _ _ */
/* _____ _| |_ ___ _ __ _ __ __ _| | (_)_ __ _ __ _ _| |_ ___ _ _ */
/* / _ \ \/ / __/ _ \ `__| `_ \ / _` | | | | `_ \| `_ \| | | | __/ __| ___ _ _| |_ _ __ _ _| |_ ___ */
/* | __/> <| || __/ | | | | | (_| | | | | | | | |_) | |_| | |_\__ \ / _ \| | | | __| `_ \| | | | __/ __| */
/* \___/_/\_\\__\___|_| |_| |_|\__,_|_| |_|_| |_| .__/ \__,_|\__|___/ | (_) | |_| | |_| |_) | |_| | |_\__ \ */
/* |_| \___/ \__,_|\__| .__/ \__,_|\__|___/ */
/* |_| */
/* d:/clx */
/* | */
/* +---fmt */
/* | c01raw_rawfmt.sas7bcat * C01 COVID Adult Vacine Study Formats */
/* | c02raw_rawfmt.sas7bcat * C02 COVID Pedriatic Study Formats D:/CLX/CLX_010MTA120 (Central DMDM fact table) */
/* | */
/* +---oto * Tools SAS autocall folder Variable Label */
/* | array.sas */
/* | arraydelete.sas SRC SAS CRF DDT SDM DMP - Source for meta data */
/* | ....... STUDY Study Identifier */
/* | utl_ymrlan100.sas TABLE Clinical Dataset CRT/SDTM/ADAM */
/* | xpy.sas VARIABLE Table SAS Dataset/CRF Module.. */
/* | QUESTION Question ie Label, Number of Obs and Max Min */
/* +---sas * Past programs to Map SDTMS ANSWER Answer ie number of obs, location of library.. */
/* | c01sdm_Ae.sas * C01 COVID Adult Vacine Study Formats / */
/* | c01sdm_Dm.sas / */
/* | c01sdm_Ex.sas / */
/* | c01sdm_Lb.sas / */
/* | c01sdm_Xp.sas / */
/* | / */
/* | c02sdm_Ae.sas / */
/* | c02sdm_Dm.sas / */
/* | c02sdm_Ex.sas / */
/* | c02sdm_Lb.sas / */
/* | c02sdm_Xp.sas / */
/* +---sd1 / */
/* c01raw_rawadverse.sas7bdat * Raw Client COVID Adult Study / */
/* c01raw_rawdemographic.sas7bdat / */
/* c01raw_rawdosing.sas7bdat / */
/* c01raw_rawlabs.sas7bdat ______ / */
/* c01raw_rawpain.sas7bdat / \ */
/* ------>| ROOT | */
/* c02raw_rawadverse.sas7bdat * Raw Client COVID Child Study | | */
/* c02raw_rawdemographic.sas7bdat | PROCES | */
/* c02raw_rawdosing.sas7bdat \______ / \ */
/* c02raw_rawlabs.sas7bdat \ */
/* c02raw_rawpain.sas7bdat \ */
/* --> d:/clx/clx_010mta130sas.sas7bdat */
/* c01sdm_ae.sas7bdat * Previously mapped SDTMs */
/* c01sdm_dm.sas7bdat Variable */
/* c01sdm_ex.sas7bdat */
/* c01sdm_lb.sas7bdat SDTM_PROGRAM Program Location */
/* c01sdm_xp.sas7bdat LINE_NUMBER Program Line Number */
/* SAS_STATEMENT SAS Statemete */
/* c02sdm_ae.sas7bdat */
/* c02sdm_dm.sas7bdat */
/* c02sdm_ex.sas7bdat */
/* c02sdm_lb.sas7bdat */
/* c02sdm_xp.sas7bdat */
/* */
/* c01adm_adae.sas7bdat * Previously mapped ADaMs */
/* c01adm_adef.sas7bdat */
/* c01adm_adsl.sas7bdat */
/* c01adm_adte.sas7bdat */
/* c02adm_adae.sas7bdat */
/* c02adm_adef.sas7bdat */
/* c02adm_adsl.sas7bdat */
/* c02adm_adte.sas7bdat */
/* */
/* */
/************************************************************************************************************************************************/
/* _ _ */
/* ___ _ _| |_ _ __ _ _| |_ */
/* / _ \| | | | __| `_ \| | | | __| */
/* | (_) | |_| | |_| |_) | |_| | |_ */
/* \___/ \__,_|\__| .__/ \__,_|\__| */
/* |_| */
/* */
/* Two Tables (so far for the star/snowflake schema) */
/* */
/* d:/clx/clx_010mta120.sas7bdat The meta data similar to OHDSI/OMOP normalized question/answer table. */
/* d:/clx/clx_010mta130sas.sas7bdat All the SDTM and ADaM mapping programs programs */
/* */
/* Contents of d:/clx/clx_010mta120.sas7bdat (can easily be hundreds of thousands os records) */
/* */
/* Variables in Creation Order */
/* */
/* # Variable Type Len Label */
/* */
/* 1 SRC Char 16 SAS CRF DDT SDM DMP - Source for meta data */
/* 2 STUDY Char 32 Study Identifier */
/* 3 TABLE Char 32 Clinical Dataset CRT/SDTM/ADAM */
/* 4 VARIABLE Char 32 Table SAS Dataset/CRF Module.. */
/* 5 QUESTION Char 32 Question ie Label, Number of Obs and Max Min */
/* 6 ANSWER Char 8192 Answer ie number of obs, location of library.. */
/* */
/* */
/* Contents of d:/clx/clx_010mta130sas.sas7bdat */
/* */
/* Variables in Creation Order */
/* */
/* # Variable Type Len */
/* */
/* 1 SDTM_PROGRAM Char 96 Program Location */
/* 2 LINE_NUMBER Num 8 Program Line Number */
/* 3 SAS_STATEMENT Char 384 SAS Statemete */
/* _ _ _ */
/* ___ __ _ _ __ ___ _ __ | | ___ ___ _ __ ___ __| |_ __ ___ _ __ ___ ___ ___ _ __ __| |___ */
/* / __|/ _` | `_ ` _ \| `_ \| |/ _ \ / __| `_ ` _ \ / _` | `_ ` _ \ | `__/ _ \/ __/ _ \| `__/ _` / __| */
/* \__ \ (_| | | | | | | |_) | | __/ | (__| | | | | | (_| | | | | | | | | | __/ (_| (_) | | | (_| \__ \ */
/* |___/\__,_|_| |_| |_| .__/|_|\___| \___|_| |_| |_|\__,_|_| |_| |_| |_| \___|\___\___/|_| \__,_|___/ */
/* |_| */
/* */
/* MAXIMUM and MINIMUM AGE */
/* ======================= */
/* */
/* SDTM AGE for C01 Study, COVID Adults Study and C02 Study, COVID Pediatric Study */
/* */
/* Obs SRC STUDY TABLE VARIABLE QUESTION ANSWER */
/* */
/* 5260 CLX_SCHEMA C01SDM C01SDM_DM AGE SDM_MIN_MAX 28@70 C01 Study, COVID Adults Study */
/* 5390 CLX_SCHEMA C02SDM C02SDM_DM AGE SDM_MIN_MAX 5@17 C02 Study, COVID Pediatric Study */
/* */
/* */
/* LAB TESTS */
/* ========= */
/* */
/* All the SDTM Lab Tests in both Studies ( ALBUMIN=30 Lab Test then frequency, @ is delimiter) */
/* */
/* SRC STUDY TABLE VARIABLE QUESTION */
/* */
/* 7217 CLX_SCHEMA C02SDM C02SDM_LB LBTEST SDM_FREQUENCIES */
/* */
/* Obs ANSWER */
/* */
/* 7217 ALBUMIN=30@ALK. PHOS.=30@ALT (SGPT)=30@AST (SGOT)=30@DIRECT BILI=30@GGTP=30@HEMATOCRIT=30@HEMOGLOBIN=30@TOTAL BILI=30@TOTAL PROT=30 */
/* */
/* LBTEST COUNT */
/* */
/* ALBUMIN 30 */
/* ALK. PHOS. 30 */
/* ALT (SGPT) 30 */
/* AST (SGOT) 30 */
/* DIRECT BILI 30 */
/* GGTP 30 */
/* HEMATOCRIT 30 */
/* HEMOGLOBIN 30 */
/* TOTAL BILI 30 */
/* TOTAL PROT 30 */
/* */
/* MAPPING DOSE */
/* ============ */
/* */
/* Querying d:/clx/clx_010mta120sas for the mapping of SDTM variable EXDOSE */
/* */
/* LINE_ */
/* Obs SDTM_PROGRAM SAS_STATEMENT NUMBER */
/* */
/* 312 D:\CLX\SAS\C01SDM_EX.SAS exdose = dailydose; 13 */
/* */
/* _ __ _ */
/* ___ _ __ ___ __| |_ __ ___ / _|_ __ ___ __ _ _ _ ___ _ __ ___(_) ___ ___ */
/* / __| `_ ` _ \ / _` | `_ ` _ \ | |_| `__/ _ \/ _` | | | |/ _ \ `_ \ / __| |/ _ \/ __| */
/* | (__| | | | | | (_| | | | | | | | _| | | __/ (_| | |_| | __/ | | | (__| | __/\__ \ */
/* \___|_| |_| |_|\__,_|_| |_| |_| |_| |_| \___|\__, |\__,_|\___|_| |_|\___|_|\___||___/ */
/* |_| */
/* */
/* COVID SCHEMA ( could add C03 study in the future) */
/* */
/* SAS CRF DDT SDM DMP - Source for meta data */
/* */
/* Cumulative Cumulative */
/* SRC Frequency Percent Frequency Percent */
/* --------------------------------------------------------------- */
/* CLX_SCHEMA 8494 100.00 8494 100.00 */
/* */
/* There two COVID studies */
/* */
/* STUDY Frequency */
/* -------------------- */
/* C01RAW 1439 Raw Data C01 Study, COVID Adults Study */
/* C02RAW 1439 Raw Data C02 Study, COVID Pediatric Study */
/* */
/* C01SDM 2189 SDTMs */
/* C02SDM 2189 */
/* */
/* C01SDM 2189 ADaM */
/* C02SDM 2189 */
/* */
/* TABLE Frequency */
/* ------------------------------ */
/* C01ADM_ADAE ADaM 172 */
/* C01ADM_ADEF 172 */
/* */
/* C01RAW_RAWDOSING RAW 114 */
/* C01RAW_RAWLABS 254 */
/* */
/* C01SDM_AE SDTM 395 */
/* C01SDM_DM 375 */
/* */
/* SAMPLE */
/* VARIABLE Frequency */
/* ------------------------------- */
/* ***TABLE_LEVEL*** 122 */
/* @0N1YF 4 */
/* $ELGR1NF 4 */
/* AEBODSYS 110 */
/* AEDECOD 110 */
/* AVAL 48 */
/* AVALC 4 */
/* AVISIT 4 */
/* BASE 24 */
/* BODYSYS 58 */
/* BRTHDT 24 */
/* BRTHDTC 48 */
/* */
/* */
/* RAW QUESTIONS SDM QUESTIONS ADM QUESTIONS */
/* ============= =============== ============= */
/* */
/* RAW_CV SDM_CV ADM_CV */
/* RAW_DISTINCT SDM_DISTINCT ADM_DISTINCT */
/* RAW_FILESIZE SDM_FILESIZE ADM_FILESIZE */
/* RAW_FORMAT SDM_FORMAT ADM_FORMAT */
/* RAW_FREQUENCIES SDM_FREQUENCIES ADM_FREQUENCIES */
/* RAW_INFORMAT SDM_INFORMAT ADM_INFORMAT */
/* RAW_LABEL SDM_LABEL ADM_LABEL */
/* RAW_LENGTH SDM_LENGTH ADM_LENGTH */
/* RAW_LEVELS_N_MISS_NONMISS SDM_LEVELS_N_MISS_NONMISS ADM_LEVELS_N_MISS_NONMISS */
/* RAW_MAX SDM_MAX ADM_MAX */
/* RAW_MEAN SDM_MEAN ADM_MEAN */
/* RAW_MEDIAN SDM_MEDIAN ADM_MEDIAN */
/* RAW_MIN SDM_MIN ADM_MIN */
/* RAW_MIN_MAX SDM_MIN_MAX ADM_MIN_MAX */
/* RAW_MIS_POP SDM_MIS_POP ADM_MIS_POP */
/* RAW_N SDM_N ADM_N */
/* RAW_NMISS SDM_NMISS ADM_NMISS */
/* RAW_NUMBER_VARIABLES SDM_NUMBER_VARIABLES ADM_NUMBER_VARIABLES */
/* RAW_OBSERVATIONS SDM_OBSERVATIONS ADM_OBSERVATIONS */
/* RAW_Q1 SDM_Q1 ADM_Q1 */
/* RAW_Q3 SDM_Q3 ADM_Q3 */
/* RAW_RECORD_LENGTH SDM_RECORD_LENGTH ADM_RECORD_LENGTH */
/* RAW_STD SDM_STD ADM_STD */
/* RAW_TYPE SDM_TYPE ADM_TYPE */
/* RAW_USER_FORMAT SDM_PROGRAM ADM_PROGRAM */
/* */
/* */
/* */
/* SAMPLE ANSWERS */
/* ============== */
/* */
/* SRC STUDY TABLE VARIABLE QUESTION ANSWER */
/* */
/* CLX_SCHEMA C01ADM C01ADM_ADAE USUBJID ADM_DISTINCT 20 */
/* CLX_SCHEMA C01ADM C01ADM_ADAE AGE ADM_MIN_MAX 29@70 */
/* CLX_SCHEMA C01RAW C01RAW_RAWADVERSE AETEXT RAW_LENGTH 26 */
/* CLX_SCHEMA C01RAW C01RAW_RAWADVERSE AEREL RAW_LABEL RELATEDNESS: 1=NOT,2=POSSIBLY,3=PROBABLY */
/* CLX_SCHEMA C01RAW C01RAW_RAWADVERSE AEREL RAW_TYPE CHAR */
/* CLX_SCHEMA C01RAW C01RAW_RAWADVERSE AEREL RAW_LENGTH 8 */
/* CLX_SCHEMA C01RAW C01RAW_RAWADVERSE AESEV RAW_LABEL SEVERITY/INTENSITY:1=MILD,2=MODERATE,3=SEVERE */
/* CLX_SCHEMA C01ADM C01ADM_ADAE AENDY ADM_LEVELS_N_MISS_NONMISS 27@1@26 */
/* CLX_SCHEMA C01ADM C01ADM_AE ***TABLE_LEVEL*** ADM_PROGRAM D:/CLX/SAS/C01ADM_AE.SAS */
/* CLX_SCHEMA C02SDM C02SDM_LB LBNRIND SDM_FREQUENCIES NORMAL=248@HIGH=43@LOW=9 */
/* CLX_SCHEMA C01ADM C01ADM_ADAE AENDT ADM_MIN_MAX 18308@18547 */
/* CLX_SCHEMA C02SDM C02SDM_DM RACE SDM_FREQUENCIES White=36@Black=18@Other=6 */
/* */
/************************************************************************************************************************************************/
*/ _ */
*/ ___ __ _ ___ __ _ _ _ ___ _ __(_) ___ ___ */
*/ / __|/ _` / __| / _` | | | |/ _ \ `__| |/ _ \/ __| */
*/ \__ \ (_| \__ \ | (_| | |_| | __/ | | | __/\__ \ */
*/ |___/\__,_|___/ \__, |\__,_|\___|_| |_|\___||___/ */
*/ |_| */
*/ */
*/ How many LAB tests are in the all of our COVID Studies */
*/ */
*/ libname clx "d:/clx"; */
*/ */
*/ proc sql; */
*/ create */
*/ table lbtest as */
*/ select */
*/ distinct */
*/ table */
*/ ,question */
*/ ,answer */
*/ from */
*/ clx.clx_010mta120 */
*/ where */
*/ variable = "LBTEST" */
*/ and question ="SDM_FREQUENCIES" */
*/ ;quit; */
*/ */
*/ data nrm(keep=table lbtest count); */
*/ set lbtest; */
*/ do idx=1 to countc(answer,'@'); */
*/ txt=scan(answer,idx,'@'); */
*/ lbtest=scan(txt,1,'='); */
*/ count =scan(txt,2,'='); */
*/ output; */
*/ end; */
*/ run;quit; */
*/ */
*/ TABLE LBTEST COUNT */
*/ */
*/ C01SDM_LB ALBUMIN 30 */
*/ C01SDM_LB ALK. PHOS. 30 */
*/ C01SDM_LB ALT (SGPT) 30 */
*/ C01SDM_LB AST (SGOT) 30 */
*/ C01SDM_LB DIRECT BILI 30 */
*/ C01SDM_LB GGTP 30 */
*/ C01SDM_LB HEMATOCRIT 30 */
*/ C01SDM_LB HEMOGLOBIN 30 */
*/ C01SDM_LB TOTAL BILI 30 */
*/ */
*/ C02SDM_LB ALBUMIN 30 */
*/ C02SDM_LB ALK. PHOS. 30 */
*/ C02SDM_LB ALT (SGPT) 30 */
*/ C02SDM_LB AST (SGOT) 30 */
*/ C02SDM_LB DIRECT BILI 30 */
*/ C02SDM_LB GGTP 30 */
*/ C02SDM_LB HEMATOCRIT 30 */
*/ C02SDM_LB HEMOGLOBIN 30 */
*/ C02SDM_LB TOTAL BILI 30 */
*/ */
*/ */
*/ */
*/ ALL REFERENCES TO SDM VARIABLE EXDOSE IN ALL PROGRAMS */
*/ */
*/ proc sql; */
*/ select */
*/ * */
*/ from */
*/ clx.clx_010mta130sas */
*/ where */
*/ upcase(sas_statement) contains "EXDOSE" */
*/ ;quit; */
*/ */
*/ */
*/ SDTM_PROGRAM SAS_STATEMENT LINE_NUMBER */
*/ ------------------------------------------------------------------------------------------------------------------- */
*/ D:\CLX\SAS\C01SDM_EX.SAS exdose = dailydose; 13 */
*/ D:\CLX\SAS\C01SDM_EX.SAS retain STUDYID DOMAIN USUBJID EXSEQ EXTRT EXDOSE EXDOSU EXDOSFRM EXDOSTOT 49 */
*/ D:\CLX\SAS\C01SDM_EX.SAS EXDOSE N8 2 Dose per Administration 99 */
*/ */
*/ D:\CLX\SAS\C02SDM_EX.SAS exdose = dailydose; 13 */
*/ D:\CLX\SAS\C02SDM_EX.SAS retain STUDYID DOMAIN USUBJID EXSEQ EXTRT EXDOSE EXDOSU EXDOSFRM EXDOSTOT 49 */
*/ D:\CLX\SAS\C02SDM_EX.SAS EXDOSE N8 2 Dose per Administration 99 */
*/ */
*/ */
*/ HOW IS SEX MAPPED */
*/ */
*/ proc sql; */
*/ select */
*/ * */
*/ from */
*/ clx.clx_010mta130sas */
*/ where */
*/ upcase(sas_statement) contains "SEX" */
*/ ;quit; */
*/ */
*/ D:\CLX\SAS\C02SDM_DM.SAS sex=gender; */
*/ */
*/ SDTM_PROGRAM SAS_STATEMENT LINE_NUMBER */
*/ ------------------------------------------------------------ */
*/ D:\CLX\SAS\C02SDM_DM.SAS sex=gender; 123 */
*/ */
/************************************************************************************************************************************************/
/* */
/* _ __ _ __ ___ ___ ___ ___ ___ */
/* | `_ \| `__/ _ \ / __/ _ \/ __/ __| */
/* | |_) | | | (_) | (_| __/\__ \__ \ */
/* | .__/|_| \___/ \___\___||___/___/ */
/* |_| */
/* */
/* */
/* 1. Download 7zip file with all the external inputs from github */
/* Unzip into your root directory. I used d:/clx for the COVID studies */
/* */
/* 2. Clear all datasets in the work directory */
/* Clear macro arrays (this is especially useful f you are testing interactively and need to rerun) */
/* */
/* INIT */
/* */
/* 1. Download 7zip file with all the external inputs from github */
/* Unzip into your root directory. I used d:/clx for the COVID studies */
/* */
/* 2. Clear all datasets in the work directory */
/* Clear macro arrays (this is especially useful f you are testing interactively and need to rerun) */
/* */
/* 3. Create attribute template for CMDM (these are the only variables that will be in the CMDM fact table */
/* */
/* %let atr=%str( */
/* length */
/* Src $16 /* SAS CRF DDT SDM DMP - Source for meta data */ */
/* Study $32 */
/* Table $32 */
/* Variable $32 */
/* Question $32 /* question see below for some of the questions */ */
/* Answer $8192; */
/* label */
/* Src = "SAS CRF DDT SDM DMP - Source for meta data" */
/* Study = "Study Identifier" */
/* Table = "Clinical Dataset CRT/SDTM/ADAM" */
/* Variable = "Table SAS Dataset/CRF Module.." */
/* Question = "Question ie Label, Number of Obs and Max Min" */
/* Answer = "Answer ie number of obs, location of library.."; */
/* keep */
/* Src */
/* Study */
/* Table */
/* Variable */
/* Question */
/* Answer;); */
/* */
/* 4. The external folder &root/sd1 has all of the raw datasets, mapped sdtm datasets and the adam datasets */
/* Create a a temp dataset with all of the datasets names */
/* */
/* 5. Assign a libname to the folder with all the external input table */
/* */
/* 6. Query the sas sas dictionary.vcolum to get type, length, labels and formats for all */
/* variables in all of the tables */
/* */
/* MACRO ARRAYs */
/* */
/* 7. Create macro array _jusTbls, with our 28 external tables in ur studies. */
/* */
/* _justbl1 ie C01SDM_AE */
/* _justbl2 */
/* _justbl3 */
/* .. */
/* _justbl28 */
/* */
/* and */
/* _justbln (which has the value 28) */
/* */
/* 8. Create these additional macro arrays */
/* */
/* _tbl# all tables */
/* _var# all vars */
/* */
/* _tblchr# tables with char vars */
/* _varchr# char vars in tables */
/* */
/* _tblnum# tables with numeric vars */
/* _varnum# numeric vars in tables */
/* */
/* POPULATE ATTRIBUTE TYPE, LENGTH .... */
/* */
/* 9. Populate attribute template with data from all tables and all variables for these questions */
/* */
/* RAW_LABEL SDM_LABEL ADM_LABEL */
/* RAW_FORMAT SDM_FORMAT ADM_FORMAT */
/* RAW_INFORMAT SDM_INFORMAT ADM_INFORMAT */
/* RAW_TYPE SDM_TYPE ADM_TYPE */
/* RAW_LENGTH SDM_LENGTH ADM_LENGTH */
/* */
/* 10. Populate N-Levels N-MissLevels N-NonMissLevels for all variables */
/* */
/* 11. Populate MIN_MAX for all variables */
/* */
/* 12. Populate frequency of Missing and Non-missing for all variables */
/* */
/* 13. Populate table level statistics for all tables */
/* */
/* OBSERVATIONS */
/* FILESIZE */
/* NUMBER_VARIABLES */
/* RECORD_LENGTH */
/* */
/* 14. Populate all formats */
/* */
/* 15. Populate staistics for all numeric variables */
/* n nmiss min q1 median mean std q3 cv max */
/* */
/* 16. Populate count distinct for all variables */
/* */
/* 17. Populate the top 30 most frequent values for all variables */
/* */
/* 18. Populate clx_010mta130sas wirh all the programs */
/* */
/* Variables in Creation Order */
/* */
/* # Variable Type Len */
/* */
/* 1 SDTM_PROGRAM Char 24 */
/* 2 SAS_STATEMENT Char 113 */
/* 3 LINE_NUMBER Num 3 */
/* */
/************************************************************************************************************************************************/
/* */
/* CHANGE HISTORY */
/* */
/* Date Programmer Comments Phone Address */
/* */
/* 1. 03/09/2022 rdeangelis@gmail.com Creation 301 655 9489 5349 N Fort Yuma Trail Tucson AZ 85750 */
/* */
/************************************************************************************************************************************************/
%*stop_submission;
/* _ _
(_)_ __ (_) |_
| | `_ \| | __|
| | | | | | |_
|_|_| |_|_|\__|
*/
%let pgm=clx_mta;
* incase you accidentally run the entire code - you need to rum this a section at a time;
%let root=d:/clx;
libname clx "&root";
libname clxsd1 "&root/sd1";
libname clxfmt "&root/fmt";
* clear the work directory;
proc datasets lib=work kill nodetails nolist mt=data;
run;quit;
* delete interim datasets if you rerun;
proc datasets lib=clx nodetails nolist;
delete
clx_010mta010
clx_020mta010
clx_030mta010
clx_040mta010
clx_050mta010
clx_060mta010
clx_070mta010
clx_080mta010
clx_090mta010
clx_100mta010
clx_110mta010
clx_120mta010
clx_130mtasas
;
run;quit;
* delete macro aarrays;
%utlnopts;
%arraydelete(_tbl )
%arraydelete(_var )
%arraydelete(_tblchr)
%arraydelete(_varchr)
%arraydelete(_tblnum)
%arraydelete(_varnum)
%utlopts;
/*
_ _ _
| |_ ___ _ __ ___ _ __ | | __ _| |_ ___
| __/ _ \ `_ ` _ \| `_ \| |/ _` | __/ _ \
| || __/ | | | | | |_) | | (_| | || __/
\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
|_|
*/
* Structure of Commom Meta data Model;
* asking question of the meta data;
%let atr=%str(
length
Src $16 /* SAS CRF DDT SDM DMP - Source for meta data */
Study $32
Table $32
Variable $32
Question $32 /* question see below for some of the questions */
Answer $8192;
label
Src = "SAS CRF DDT SDM DMP - Source for meta data"
Study = "Study Identifier"
Table = "Clinical Dataset CRT/SDTM/ADAM"
Variable = "Table SAS Dataset/CRF Module.."
Question = "Question ie Label, Number of Obs and Max Min"
Answer = "Answer ie number of obs, location of library..";
keep
Src
Study
Table
Variable
Question
Answer;);
/* _ _
___ _ __ | |_(_) ___ _ __ ___
/ _ \| `_ \| __| |/ _ \| `_ \/ __|
| (_) | |_) | |_| | (_) | | | \__ \
\___/| .__/ \__|_|\___/|_| |_|___/
|_|
*/
options sasautos=("&root/oto" ) compress=binary validvarname=upcase ls=255;
/*_ __ _ ____ ____ ___ _ ____ ____ _ __ ______
| \/ | / \ / ___| _ \ / _ \ / \ | _ \| _ \ / \\ \ / / ___|
| |\/| | / _ \| | | |_) | | | | / _ \ | |_) | |_) | / _ \\ V /\___ \
| | | |/ ___ \ |___| _ <| |_| | / ___ \| _ <| _ < / ___ \| | ___) |
|_| |_/_/ \_\____|_| \_\\___/ /_/ \_\_| \_\_| \_\/_/ \_\_| |____/
_ _ _
_ __ __ ___ __ ___ __ _ ___ | |_ __ _| |__ | | ___ ___
| `__/ _` \ \ /\ / / / __|/ _` / __| | __/ _` | `_ \| |/ _ \/ __|
| | | (_| |\ V V / \__ \ (_| \__ \ | || (_| | |_) | | __/\__ \
|_| \__,_| \_/\_/ |___/\__,_|___/ \__\__,_|_.__/|_|\___||___/
*/
* these arrays wiil be used over and over again;
%utl_dirlst(&root/sd1,clx_010mtaSd1);
/**************************************************************************************************************************/
/* */
/* Up to 40 obs WORK.CLX_010MTASD1 total obs=28 07MAR2022:15:18:2 */
/* */
/* FILENAME FILENAME FILENAME */
/* */
/* RAW date to Map SDTMs ADAM */
/* */
/* c01raw_rawadverse.sas7bdat c01sdm_ae.sas7bdat c01adm_adae.sas7bdat */
/* c01raw_rawdemographic.sas7bdat c01sdm_dm.sas7bdat c01adm_adef.sas7bdat */
/* c01raw_rawdosing.sas7bdat c01sdm_ex.sas7bdat c01adm_adsl.sas7bdat */
/* c01raw_rawlabs.sas7bdat c01sdm_lb.sas7bdat c01adm_adte.sas7bdat */
/* c01raw_rawpain.sas7bdat c01sdm_xp.sas7bdat c02adm_adae.sas7bdat */
/* c02raw_rawadverse.sas7bdat c02sdm_ae.sas7bdat c02adm_adef.sas7bdat */
/* c02raw_rawdemographic.sas7bdat c02sdm_dm.sas7bdat c02adm_adsl.sas7bdat */
/* c02raw_rawdosing.sas7bdat c02sdm_ex.sas7bdat c02adm_adte.sas7bdat */
/* c02raw_rawlabs.sas7bdat c02sdm_lb.sas7bdat */
/* c02raw_rawpain.sas7bdat c02sdm_xp.sas7bdat */
/* */
/**************************************************************************************************************************/
data clx_010mtaLst;
length sd1 $32;
set clx_010mtaSd1;
if index(filename,'sas7bdat')>0;
sd1=upcase(cats(scan(filename,1,"."))) ;
keep sd1;
run;quit;
/**************************************************************************************************************************/
/* */
/* Up to 40 obs WORK.CLX_010MTALST total obs=28 07MAR2022:15:21:46 */
/* */
/* SD1 SD1 AD1 */
/* */
/* RAW date to Map SDTMs ADAMs */
/* */
/* c01raw_rawadverse c01sdm_ae c01adm_adae */
/* c01raw_rawdemographic c01sdm_dm c01adm_adef */
/* c01raw_rawdosing c01sdm_ex c01adm_adsl */
/* c01raw_rawlabs c01sdm_lb c01adm_adte */
/* c01raw_rawpain c01sdm_xp c02adm_adae */
/* c02raw_rawadverse c02sdm_ae c02adm_adef */
/* c02raw_rawdemographic c02sdm_dm c02adm_adsl */
/* c02raw_rawdosing c02sdm_ex c02adm_adte */
/* c02raw_rawlabs c02sdm_lb */
/* c02raw_rawpain c02sdm_xp */
/* */
/***************************************************************************************************************************
/*
_ __ ___ __ _ ___ _ __ ___ __ _ _ __ _ __ __ _ _ _ ___
| `_ ` _ \ / _` |/ __| `__/ _ \ / _` | `__| `__/ _` | | | / __|
| | | | | | (_| | (__| | | (_) | | (_| | | | | | (_| | |_| \__ \
|_| |_| |_|\__,_|\___|_| \___/ \__,_|_| |_| \__,_|\__, |___/
_ _ _ _ |___/
_ __ __ ___ __ __| (_) ___| |_(_) ___ _ __ __ _ _ __ _ _
| `__/ _` \ \ /\ / / / _` | |/ __| __| |/ _ \| `_ \ / _` | `__| | | |
| | | (_| |\ V V / | (_| | | (__| |_| | (_) | | | | (_| | | | |_| |
|_| \__,_| \_/\_/ \__,_|_|\___|\__|_|\___/|_| |_|\__,_|_| \__, |
|___/
*/
* bootstrap from meta data;
proc sql;
create
table clx.clx_010mta010 as
select
'CLX_SCHEMA' as Src length 32
,memname as Table length=32
,name as Variable length=32
,upcase(coalesce(label,name)) as label length=8192
,scan(memname,1,'_') as study length=32
,coalesce(format,"NULL") as format length=8192
,coalesce(informat,"NULL") as informat length=8192
,upcase(type) as type length=8192
,length
from
sashelp.vcolumn
where
libname="CLXSD1"
;quit;
/************************************************************************************************************************************************/
/* */
/*Up to 40 obs from CLX.CLX_010MTA010 total obs=462 09MAR2022:09:22:49 */
/* */
/*Obs SRC TABLE VARIABLE LABEL STUDY FORMAT INFORMAT TYPE LENGTH */
/* */
/* 1 CLX_SCHEMA C01ADM_ADAE STUDYID STUDY IDENTIFIER C01ADM NULL NULL CHAR 15 */
/* 2 CLX_SCHEMA C01ADM_ADAE USUBJID UNIQUE SUBJECT IDENTIFIER C01ADM NULL NULL CHAR 25 */
/* 3 CLX_SCHEMA C01ADM_ADAE SITEID STUDY SITE IDENTIFIER C01ADM NULL NULL CHAR 7 */
/* 4 CLX_SCHEMA C01ADM_ADAE COUNTRY COUNTRY C01ADM NULL NULL CHAR 3 */
/* 5 CLX_SCHEMA C01ADM_ADAE AESEQ SEQUENCE NUMBER C01ADM NULL NULL NUM 8 */
/* 6 CLX_SCHEMA C01ADM_ADAE AGE UNIQUE SUBJECT IDENTIFIER C01ADM NULL NULL NUM 8 */
/* ... */
/************************************************************************************************************************************************/
/* _ _ _ _ _
(_)_ _ ___| |_ | |_ __ _| |__ | | ___ ___
| | | | / __| __| | __/ _` | `_ \| |/ _ \/ __|
| | |_| \__ \ |_ | || (_| | |_) | | __/\__ \
_/ |\__,_|___/\__| \__\__,_|_.__/|_|\___||___/
|__/
*/
proc sql noprint;
*reset inobs=3;
select
distinct
Table
into
:_jusTbl1-
from
clx.clx_010mta010
;quit;
%let _jusTbln=&sqlobs;
%let _endtbl=&&_jusTbl&_jusTbln;
%utlnopts;
%put &=_jusTbln Table for each variable;
%put &=_jusTbl1 First table in macro array;
%put &=_endTbl Last table in macro array;
%utlopts;
/**************************************************************************************************************************/
/* */
/* _JUSTBLN=28 Tables */
/* */
/* _JUSTBL1=C01RAW_RAWADVERSE First table in macro array */
/* _ENDTBL=C02SDM_XP Last table in macro array */
/* */
/**************************************************************************************************************************/
/*
__ ____ _ _ __ ___
\ \ / / _` | `__/ __|
\ V / (_| | | \__ \
\_/ \__,_|_| |___/
*/
proc sql noprint;
*reset inobs=3;
select
Table
,Variable
into
:_tbl1-
,:_var1-
from
clx.clx_010mta010
;quit;
%let _tbln=&sqlobs;
%let _varn=&sqlobs;
%let _endtbl=&&_tbl&_tbln;
%let _endvar=&&_var&_varn;
%utlnopts;
%put &=_tbln Table for each variable;
%put &=_varn Number of Variables;
%put &=_tbl1 First table in macro array;
%put &=_endtbl Last table in macro array;
%put &=_var1 First Variable in macro array;
%put &=_endvar Last variable in macro array;
%utlopts;
/**************************************************************************************************************************/
/* */
/* MACRO ARRAY RAW VARIABLES WITH 462 VARIABLE NAMES AND ASSOCIATED TABLE NAMES */
/* */
/* */
/* _TBLN=462 Tables for each variable */
/* _VARN=462 Number of Variables */
/* _TBL1=C01RAW_RAWADVERSE First table in macro array */
/* _ENDTBL=C02SDM_XP Last table in macro array */
/* _VAR1=SUBJECT First Variable in macro array */
/* _ENDVAR=XPSTRESN Last variable in macro array */
/* */
/**************************************************************************************************************************/
/* _
___| |__ __ _ _ __ __ ____ _ _ __ ___
/ __| `_ \ / _` | `__| \ \ / / _` | `__/ __|
| (__| | | | (_| | | \ V / (_| | | \__ \
\___|_| |_|\__,_|_| \_/ \__,_|_| |___/
*/
proc sql noprint;
*reset inobs=3;
select
table
,Variable
into
:_tblchr1-
,:_varchr1-
from
clx.clx_010mta010
where
upcase(type)="CHAR"
;quit;
%let _tblchrn=&sqlobs;
%let _varchrn=&sqlobs;
%let _endtbl=&&_tblchr&_tblchrn;
%let _endvar=&&_varchr&_varchrn;
%utlnopts;
%put &=_tblchrn Table for each char ble;
%put &=_varchrn Number of Char Variables;
%put &=_tblchr1 First table in char macro array;
%put &=_endtbl Last table in char macro array;
%put &=_varchr1 First char Variable in macro array;
%put &=_endvar Last chr variable in macro array;
%utlopts;
/**************************************************************************************************************************/
/* */
/* _TBLCHRN=292 Tables for each char ble */
/* _VARCHRN=292 Number of Char Variables */
/* */
/* _TBLCHR1=RAWADVERSE First table in char macro array */
/* _ENDTBL=C02SDM_XP Last table in char macro array */
/* */
/* _VARCHR1=BODYSYS First char Variable in macro array */
/* _ENDVAR=XPSTRESC Last chr variable in macro array */
/* */
/**************************************************************************************************************************/
/*
_ __ _ _ _ __ ___ __ ____ _ _ __ ___
| `_ \| | | | `_ ` _ \ \ \ / / _` | `__/ __|
| | | | |_| | | | | | | \ V / (_| | | \__ \
|_| |_|\__,_|_| |_| |_| \_/ \__,_|_| |___/
*/
proc sql noprint;
*reset inobs=3;
select
table
,Variable
into
:_tblnum1-
,:_varnum1-
from
clx.clx_010mta010
where
upcase(type)="NUM"
;quit;
%let _tblnumn=&sqlobs;
%let _varnumn=&sqlobs;
%let _endtbl=&&_tblnum&_tblnumn;
%let _endvar=&&_varnum&_varnumn;
%utlnopts;
%put &=_tblnumn Table for each num ble;
%put &=_varnumn Number of num variables;
%put &=_tblnum1 First table in num macro array;
%put &=_endtbl Last table in num macro array;
%put &=_varnum1 First num variable in macro array;
%put &=_endvar Last num variable in macro array;
%utlopts;
/**************************************************************************************************************************/
/* */
/* _TBLNUMN=170 Table for each num ble */
/* _VARNUMN=170 Number of num variables */
/* */
/* _TBLNUM1=RAWADVERSE First table in num macro array */
/* _ENDTBL=C02SDM_XP Last table in num macro array */
/* */
/* _VARNUM1=SUBJECT First num variable in macro array */
/* _ENDVAR=XPSTRESN Last num variable in macro array */
/* */
/**************************************************************************************************************************/
/**************************************************************************************************************************/
/* */
/* Available macro arrays */
/* */
/* _jusTbl# */
/* */