KME252 3 5subjs 1 332 1 14 %csg_subset_subjects_001(subjdsn=adam.adsl ,subjvar=usubjid ,subjmasking=%str() ,trtvar=trt01pn ,add_vars_from_subjdsn=trt01pn ,nsubjs=5 ,indsn=sdtm.mh ,indsnwhere=%str() ,outdsn=admh ,macid=subsubj_ ,randompick=Y ,debug=Y ); 44 1 252 3 ch1 17 253 1 251 1 47 251 1 42 251 1 60 251 1 104 251 1 49 251 1 62 287 1 255 1 287 1 251 1 60 251 1 47 251 1 104 251 1 49 251 1 62 251 1 42 251 1 47 12 0 252 3 ch2 17 253 1 251 1 47 251 1 42 251 1 60 251 1 104 251 1 50 251 1 62 287 1 255 1 287 1 251 1 60 251 1 47 251 1 104 251 1 50 251 1 62 251 1 42 251 1 47 11 0 252 3 ch3 21 253 1 251 1 47 251 1 42 251 1 60 251 1 104 251 1 51 251 1 62 287 1 255 1 287 1 251 1 47 251 1 42 280 1 280 1 251 1 60 251 1 47 251 1 104 251 1 51 251 1 62 251 1 42 251 1 47 14 0 252 3 cmi 1 332 1 1 %create_master_index(indsn=%str(root.master_metadata),indexloc=%str(&root.),runexport=N,runwebpage=N); 61 1 252 3 cmnt1 1 332 1 4 *==============================================================================; * ; *==============================================================================; 37 1 252 3 cmnt2 1 332 1 4 *------------------------------------------------------------------------------; * ; *------------------------------------------------------------------------------; 38 1 252 3 cmnt3 1 332 1 4 %*=============================================================================; %* ; %*=============================================================================; 39 1 252 3 cmnt4 1 332 1 4 %*-----------------------------------------------------------------------------; %* ; %*-----------------------------------------------------------------------------; 40 1 252 3 countcheck 1 332 1 67 %macro countcheck(dsn1=, dsn2=, byvar=); data _left; set &dsn1; run; data _right; set &dsn2; run; %local tablevar; %let byvar=%sysfunc(compbl(&byvar.)); %let tablevar =%sysfunc(tranwrd(&byvar.,%str( ),%str(*))); proc freq data= _left noprint ; tables &tablevar. /list missing out=_uniquevalues01; where 1=1; run; proc freq data= _right noprint; tables &tablevar. /list missing out=_uniquevalues02; where 1=1; run; data full both aonly bonly; merge _uniquevalues01(in=a drop=percent rename=(count=counta)) _uniquevalues02(in=b drop=percent rename=(count=countb)); by &byvar.; if counta ne countb then cmiss=1; if a and b then both=1; if a and not b then aonly=1; if b and not a then bonly=1; if a or b then output full; if a and b then output both; if a and not b then output aonly; if b and not a then output bonly; run; proc sort data=_left out=_left_sort; by &byvar.; run; data check_a; merge _left_sort(in=a) full(in=b); by &byvar.; if a; run; proc sort data=_right out=_right_sort; by &byvar.; run; data check_b; merge _right_sort(in=a) full(in=b); by &byvar.; if a; run; %mend countcheck; %countcheck(dsn1= , dsn2= , byvar= ); 4 1 g252 3 cput 10 254 1 253 1 251 1 112 251 1 117 251 1 116 251 1 32 251 1 39 255 1 251 1 39 251 1 59 9 0 .252 3 csg_mult 1 332 1 108 %*=============================================================================; %*Sort multiple datasets with same by variables; %*=============================================================================; %macro multsort(dsnlist=%str( ),byvars=%str( ),where=%str()); %local _dsncount _dsni _currentdsn; %let _dsncount=%sysfunc(countw(&dsnlist,%str( ))); %do _dsni=1 %to &_dsncount.; %let _currentdsn=%scan(&dsnlist.,&_dsni,%str( )); proc sort data= &_currentdsn. out=%scan(&_currentdsn.,-1,%str(.))_out; by &byvars.; where &where.; run; %end; %mend multsort; %*=============================================================================; %*Removing duplicates based on same by variables from multiple datasets; %*=============================================================================; %macro multdup(dsnlist=%str( ),byvars=%str( ),where=%str()); %local _dsncount _dsni _currentdsn; %let _dsncount=%sysfunc(countw(&dsnlist,%str( ))); %do _dsni=1 %to &_dsncount.; %let _currentdsn=%scan(&dsnlist.,&_dsni,%str( )); proc sort data= &_currentdsn. out=%scan(&_currentdsn.,-1,%str(.))_firstocc dupout=%scan(&_currentdsn.,-1,%str(.))_subsqoccs nodupkey; by &byvars.; where &where.; run; %end; %mend multdup; %*=============================================================================; %*Checking for the unique and non-unique records based on same by variables in multiple dataset; %*=============================================================================; %macro multuniq(dsnlist=%str( ),byvars=%str( ),where=%str()); %local _dsncount _dsni _currentdsn; %let _dsncount=%sysfunc(countw(&dsnlist,%str( ))); %do _dsni=1 %to &_dsncount.; %let _currentdsn=%scan(&dsnlist.,&_dsni,%str( )); proc sort data= &_currentdsn. out=%scan(&_currentdsn.,-1,%str(.))_nonuniq uniqueout=%scan(&_currentdsn.,-1,%str(.))_uniq nouniquekeys; by &byvars.; where &where.; run; %end; %mend multuniq; %*=============================================================================; %*Checking for the unique and non-unique records based on same by variables in multiple dataset; %*=============================================================================; %macro multfreq(dsnlist=%str( ),tables=%str( ),where=%str()); %local _dsncount _dsni _tablesi _tablescount _currentdsn _currentable; %let _dsncount=%sysfunc(countw(&dsnlist,%str( ))); %let _tablescount=%sysfunc(countw(&tables,%str( ))); %do _dsni=1 %to &_dsncount.; %let _currentdsn=%scan(&dsnlist.,&_dsni,%str( )); proc freq data= &_currentdsn ; %do _tablesi=1 %to &_tablescount.; %let _currenttable=%scan(&tables.,&_tablesi,%str( )); tables &_currenttable. /list missing out=%scan(&_currentdsn.,-1,%str(.))_freq0&_tablesi.; %end; where 1=1; run; %end; %mend multfreq; %macro multsqlf(dsnlist=%str( ),filterdsn=,innotin=%str(in),catsvars=%str(usubjid),selectvars=%str(*),outerwhere=%str(1=1),innerwhere=%str(1=1)); %local _dsncount _dsni _currentdsn; %let _dsncount=%sysfunc(countw(&dsnlist,%str( ))); %do _dsni=1 %to &_dsncount.; %let _currentdsn=%scan(&dsnlist.,&_dsni,%str( )); proc sql; create table %scan(&_currentdsn.,-1,%str(.))_sqlf as select &selectvars. from &_currentdsn. where cats(&catsvars.) &innotin. (select distinct cats(&catsvars.) from &filterdsn. where &innerwhere. ) and &outerwhere.; quit; %end; %mend multsqlf; 63 1 252 3 cta copy as html table 28 253 1 251 1 47 251 1 42 251 1 60 251 1 116 251 1 97 251 1 98 251 1 108 251 1 101 251 1 63 280 1 251 1 62 287 1 255 1 251 1 60 251 1 47 251 1 116 251 1 97 251 1 98 251 1 108 251 1 101 251 1 63 280 1 251 1 47 280 1 251 1 62 251 1 42 251 1 47 28 0 252 3 ctd add html table data 18 253 1 251 1 44 280 1 251 1 60 251 1 116 251 1 100 251 1 62 287 1 251 1 60 280 1 255 1 287 1 251 1 60 251 1 47 251 1 116 251 1 100 251 1 62 287 1 34 0 252 3 ctext 29 253 1 251 1 42 251 1 60 251 1 116 251 1 101 251 1 120 251 1 116 251 1 97 251 1 114 251 1 101 251 1 97 251 1 62 251 1 59 287 1 255 1 287 1 251 1 42 251 1 60 251 1 47 251 1 116 251 1 101 251 1 120 251 1 116 251 1 97 251 1 114 251 1 101 251 1 97 251 1 62 251 1 59 10 0 252 3 cth add html table header 14 253 1 251 1 60 251 1 116 251 1 104 251 1 62 287 1 255 1 287 1 251 1 60 251 1 47 251 1 116 251 1 104 251 1 62 287 1 29 0 252 3 ctr add html table row 14 253 1 251 1 60 251 1 116 251 1 114 251 1 62 287 1 255 1 287 1 251 1 60 251 1 47 251 1 116 251 1 114 251 1 62 287 1 35 0 I252 3 dhf 1 332 1 1 %datasets_html_for_sascncpts(datasets=%str()); 62 1 g252 3 dqp 10 254 1 253 1 251 1 112 251 1 117 251 1 116 251 1 32 251 1 34 255 1 251 1 34 251 1 59 27 0 = 252 3 header 1 332 1 31 %******************************************************************** **; %** Project : Sample Drug, Sample Indication,Study1 **; %** Program name : sample.sas **; %** Author : CKID9 **; %** Date created : 2018-07-08 **; %** Purpose : This is the purpose of the program. **; %** **; %** **; %******************************************************************** **; %** Addtional details : **; %******************************************************************** **; %** Data source: **; %** Documentation source: **; %** Etc: **; %** **; %******************************************************************** **; %** Revision History : **; %******************************************************************** **; %** **; %**----------------------------------------------------------------------------------- **; %** Revision number : **; %** Author/Date : **; %** Modification : **; %** Reason : **; %** Version signature: Eg: [001: CKID9/1Jan1960] **; %**----------------------------------------------------------------------------------- **; %** **; %** **; %******************************************************************** **; 0 1 252 3 htinsert 1 332 1 17 /*
*/ 36 1 ,252 3 htmh1 1 332 1 3 *

; *

; 23 1 ,252 3 htmh2 1 332 1 3 *

; *

; 24 1 +252 3 htmh3 1 332 1 3 *

; *

; 3 1 ,252 3 htmh4 1 332 1 3 *

; *

; 25 1 #252 3 htmlbr 1 332 1 1
19 1 ,252 3 htmlh1 1 332 1 3 /*

*/ 5 1 ,252 3 htmlh2 1 332 1 3 /*

*/ 6 1 ,252 3 htmlh3 1 332 1 3 /*

*/ 7 1 ,252 3 htmlh4 1 332 1 3 /*

*/ 8 1 (252 3 htmlli 1 332 1 1
  • 16 1 -252 3 htmlol 1 332 1 3 /*
    */ 15 1 *252 3 htmlp 1 332 1 3 /*

    */ 20 1 0252 3 htmlpre 1 332 1 3 *
    ;
    
    *
    ; 17 1 2252 3 htmlsp 1 332 1 1      43 1 3252 3 htmlta 1 332 1 3 /*
    */ 21 1 )252 3 htmltd 1 332 1 3 13 1 J252 3 htmltd2 1 332 1 9 60 1 Z252 3 htmltd3 1 332 1 12 42 1 <252 3 htmltext 1 332 1 4 *; 18 1 )252 3 htmlth 1 332 1 3 22 1 =252 3 htmlth2 1 332 1 7 59 1 M252 3 htmlth3 1 332 1 10 41 1 )252 3 htmltr 1 332 1 3 26 1 -252 3 htmlul 1 332 1 3 /**/ 30 1 c252 3 multdup 1 332 1 2 %multdup(dsnlist=%str( ae ),byvars=%str( usubjid ),where=%str( )); 65 1 e252 3 multfreq 1 332 1 2 %multfreq(dsnlist=%str( ae ),tables=%str( usubjid ),where=%str( )); 67 1 e252 3 multsort 1 332 1 2 %multsort(dsnlist=%str( ae ),byvars=%str( usubjid ),where=%str( )); 64 1 252 3 multsqlf 1 332 1 2 %multsqlf(dsnlist=%str( ),filterdsn=,innotin=%str(in),catsvars=%str(usubjid),selectvars=%str(*),outerwhere=%str(1=1),innerwhere=%str(1=1)); 68 1 e252 3 multuniq 1 332 1 2 %multuniq(dsnlist=%str( ae ),byvars=%str( usubjid ),where=%str( )); 66 1 1252 3 nbsp4 1 332 1 1      58 1 F252 3 pdata 1 332 1 5 data out; set in; where ; run; 51 1 e252 3 pdummy 1 332 1 7 data dummy; do variable=1 to 3; output; end; run; 54 1 p252 3 pdup 1 332 1 5 proc sort data=indsn out=outdsn dupout=dupdsn nodupkey; by ; where ; run; 53 1 p252 3 pfirst 1 332 1 7 data out; set in; by ; if first. then xflag=1; if xflag=1; run; 50 1 r252 3 pfreq 1 332 1 7 proc freq data= ; tables /list missing out=_uniquevalues01; where 1=1; run; 31 1 w252 3 pmerge 1 332 1 8 data mergeout; merge one(in=a) two(in=b); by ; if a or b; run; 49 1 9252 3 postprod 1 332 1 2 %&_x_debug.gen_term_001; 2 1 K252 3 preprod 1 332 1 4 %let _x_debug=; %&_x_debug.gen_init_001; 1 1 L252 3 psort 1 332 1 5 proc sort data= ; by ; where ; run; 47 1 252 3 psql 1 332 1 8 proc sql; create table outdsn as select * from indsn where 1=1 ; quit; 52 1 252 3 psum 1 332 1 9 proc summary data= n nmiss mean std min q1 median q3 max range print; class ; where 1=1; var ; output out=_summarystats01 n= nmiss= mean= std= min= q1= median= q3= max= range=/autoname; run; 32 1 252 3 ptotdup 1 332 1 11 data outdsn; set indsn; where ; treatment= trt01an; output; treatment=99; output; run; 55 1 252 3 ptotmac 1 332 1 7 data _null_; set trttotal; call symputx(cats("n",treatment),trttotal); run; %put ; 56 1 m252 3 ptrans 1 332 1 7 proc transpose data= out= ; by ; var ; id ; where ; run; 48 1 z252 3 puniq 1 332 1 8 proc sort data= out=_x uniqueout=_y nouniquekeys; by ; where 1=1; run; 33 1 252 3 sqlf 1 332 1 12 proc sql; create table x as select * from where cats() in (select distinct cats() from where 1=1 ) and 1=1; quit; 45 1 252 3 sqlvlist 1 332 1 10 options ls=200; proc sql noprint; select distinct name into : varlist separated by ';' from dictionary.columns where upcase(libname)="RAW" and upcase(memname)="LTFUP" order by varnum; quit; %put &=varlist.; 57 1 (252 3 xmerge 1 332 1 20 %let dsn1= ; %let dsn2= ; %let outdsn= ; %let byvar= ; proc sort data=&dsn1.; by &byvar.; run; proc sort data=&dsn2.; by &byvar.; run; data &outdsn.; merge &dsn1.(in=a) &dsn2.(in=b); by &byvar.; ina=a; inb=b; run; 46 1