/*Dataset*/
LIBNAME mylib ‘/home/u61325000/sasuser.v94’;
data capstone;
set mylib.sanni;
if age =’90+’ then age2=90;
else age2=10*age/10;
if diabetes = ‘INSULIN’ or diabetes = ‘NON-INSULIN’ then
diabetes2 = ‘ONMEDYES’;
else if diabetes = ‘NO’ then diabetes2=’ONMEDNO’;
if CPT= ‘43644’ then Procedure=’LGBP’;
else if CPT= ‘43770’ then Procedure=’LAGB’;
else if CPT= ‘43775’ then Procedure=’LSG’;
run;
/* Proc contents */
proc contents data=capstone;
run;
/*DIABETES AND DIABETES 2*/
proc freq data=capstone;
tables diabetes2;
run;
proc freq data=capstone;
tables diabetes;
run;
/*2A.Theory of Change Analysis*/
/* a.wound complication for Superficial Site Infection*/
proc freq data=capstone;
table supinfec;
run;
/*b.wound complication for Deep Site Infection*/
proc freq data=capstone;
table wndinfd;
run;
/*c.Organ Space Site infection*/
proc freq data=capstone;
table ORGSPCSSI;
run;
/*Wound Dehiscence*/
proc freq data=capstone;
tables dehis;
run;
/*2B. Theory of Change Analysis*/
/*diabetes2*/
proc freq data=capstone;
tables diabetes2;
run;
/*Association between diabetes2 and BMI*/
proc logistic data=CAPSTONE;
class DIABetes2 / param=ref ;
model supinfec = DIABetes2 BMI ;
run;
proc logistic data=CAPSTONE;
class DIABetes2 / param=ref ;
model wndinfd = DIABetes2 BMI ;
run;
proc logistic data=CAPSTONE;
class DIABetes2 / param=ref ;
model ORGSPCSSI = DIABetes2 BMI ;
run;
proc logistic data=CAPSTONE;
class DIABetes2 / param=ref ;
model dehis = DIABetes2 BMI ;
run;
/*Association between diabetes2 and age*/
proc logistic data=CAPSTONE;
class DIABetes2 / param=ref ;
model supinfec = DIABetes2 age2 ;
run;
proc logistic data=CAPSTONE;
class DIABetes2 / param=ref ;
model wndinfd = DIABetes2 age2 ;
run;
proc logistic data=CAPSTONE;
class DIABetes2 / param=ref ;
model ORGSPCSSI = DIABetes2 age2 ;
run;
proc logistic data=CAPSTONE;
class DIABetes2 / param=ref ;
model dehis = DIABetes2 age2 ;
run;
/*END*/
/*To find the association between wound complication supinfec and Bmi*/
proc logistic data=CAPSTONE;
class BMI / param=ref ;
model supinfec = BMI ;
run;
/*procedure*/
/*Relation between wound complications, bariatric procedures, age2 and bmi*/
/*one-supinfec*/
proc logistic data=CAPSTONE;
class DIABetes2 procedure/param=ref;
model supinfec = procedure DIABetes2 age2 BMI ;
run;
/*two-organ space infection*/
proc logistic data=CAPSTONE;
class DIABetes2 procedure/ param=ref ;
model ORGSPCSSI = procedure DIABetes2 age2 BMI ;
run;
/*three-deep site infection*/
proc logistic data=CAPSTONE;
class DIABetes2 procedure/ param=ref ;
model wndinfd = procedure DIABetes2 age2 BMI ;
run;
/*four-wound dehiscence*/
proc logistic data=CAPSTONE;
class DIABetes2 procedure/ param=ref ;
model dehis = procedure DIABetes2 age2 BMI ;
run;
/*age2*/
proc freq data=capstone;
tables age2;
run;
proc logistic data=CAPSTONE;
class diabetes2 procedure ;
model supinfec = procedure DIABetes2 age2 ;
run;
proc logistic data=CAPSTONE;
class diabetes2 ;
model supinfec = DIABetes2 age2 ;
run;
/*Measurement and Estimation Analysis*/
/*Doubt table 1 : age bmi*/
/*table 1: sex race inpatient asa*/
/*table-1 age*/
proc means data=capstone;
class procedure;
var age2;
run;
proc glm data=capstone plots (maxpoints=10000);
class procedure;
model Age2 = procedure;
means procedure/Tukey; /* Tukey’s post hoc test for pairwise comparisons */
run;
quit;
proc freq data=capstone;
table age2;
run;
/*table 1 bmi*/
proc means data=capstone;
class procedure;
var bmi;
run;
proc glm data=capstone;
class procedure;
model bmi = procedure;
means procedure / tukey; /* Tukey’s post hoc test for pairwise comparisons */
run;
quit;
PROC FREQ DATA=capstone;
TABLES sex*procedure race_new*procedure inout*procedure asaclas*procedure/chisq;
RUN;
/*table 2 */
/* doubt : mortality morbidity */
/*No details about Morbidity*/
/*mortality*/
data updated;
set capstone; /* Replace your_dataset with your actual dataset name */
if YRDEATH in (2010, 2011) then YRDEATH_GROUPED = “2010-2011”;
else if YRDEATH = -99 then YRDEATH_GROUPED = “-99”;
else YRDEATH_GROUPED = “Other”; /* Adjust based on how you want to handle other years */
run;
proc freq data=updated;
tables YRDEATH_GROUPED*CPT / chisq missing;
title “Frequency of YRDEATH_GROUPED by CPT”;
run;
/*reoperation*/
proc freq data=capstone;
table returnor*procedure/chisq;
run;
/*OPtime*/
PROC MEANS DATA=capstone mean min std ;
CLASS procedure;
VAR Optime;
RUN;
PROC ANOVA DATA=capstone PLOTS(MAXPOINTS=NONE);
CLASS procedure;
MODEL Optime = procedure;
RUN;
/*Length of stay*/
proc npar1way data=capstone;
class procedure;
var tothlos;
run;
proc univariate data=capstone nextrobs=0;
class procedure;
var tothlos;
output out=location
mean=Mean mode=Mode median=Median
q1=Q1 q3=Q3 p5=P5 p10=P10 p90=P90 p95=P95
max=Max;
run;
proc print data=location noobs;
run;
/*table 3*/
PROC FREQ DATA=capstone;
TABLES noupneumo*procedure ReIntub*procedure Pulembol*procedure
FailWean*procedure RenaInsf*procedure
Urninfec*procedure
nothdvt*procedure /chisq;
RUN;
proc freq data=capstone;
tables cdmi*procedure nothbleed*procedure Cdarrest*procedure neurodef*procedure dcnscoma*procedure noprenafl*procedure cnscva*procedure/fisher;
run;
/*table 4*/
/*wound complications*/
/*superficial*/
proc freq data=capstone;
tables supinfec*procedure/chisq;
run;
/*Deep site infection*/
proc freq data=capstone;
table wndinfd*procedure/chisq;
run;
/*Organ space site infection*/
proc freq data=capstone;
table ORGSPCSSI*procedure/chisq;
run;
/*wound dehiscence*/
/*As sample size is small used Fisher’s exact test*/
proc freq data=capstone;
tables dehis*procedure/fisher;
run;
/*Table 5*/
/*PROC LOGISTIC DATA=capstone;
CLASS age2 bmi ;
MODEL complications(event=’1′) = age_group bmi_group other_potential_confounders / SELECTION=BACKWARD;
/* Specify other options as needed */
* Create a SAS dataset with the given data */
/* Univariate analysis using logistic regression for each risk factor and complications */
/* For each of the three surgical procedures: LGBP, LSG, and LAGB */
/* LGBP Procedure */
proc logistic data=capstone;
class ASA_class diabetes dyspnea COPD HTN / param=ref;
model complications(event=’1′) = ASA_class diabetes dyspnea COPD HTN;
where procedure = ‘LGBP’;
output out=univariate_LGBP p=predicted;
run;
/* LSG Procedure */
proc logistic data=capstone;
class ASA_class diabetes dyspnea COPD HTN / param=ref;
model complications(event=’1′) = ASA_class diabetes dyspnea COPD HTN;
where procedure = ‘LSG’;
output out=univariate_LSG p=predicted;
run;
/* LAGB Procedure */
proc logistic data=capstone;
class ASA_class diabetes dyspnea COPD HTN / param=ref;
model complications(event=’1′) = ASA_class diabetes dyspnea COPD HTN;
where procedure = ‘LAGB’;
output out=univariate_LAGB p=predicted;
run;
/* Compare the odds ratios (OR) and p-values for each of the surgical procedures */
proc means data=univariate_LGBP univariate_LSG univariate_LAGB nway noprint;
var predicted;
class complications;
output out=table5_summary mean=OR;
run;