Bailey DeBarmore is a doctoral student at the University of North Carolina at Chapel Hill studying epidemiology. Find her on Twitter@BaileyDeBarmore and blogging for the American Heart Association on the Early Career Voice blog. 
&let data=<dataset>;
&let outcome=<outcome>;
&let var=<var>;
proc genmod data=&data descending;
model &outcome = &var / link=logit dist=binomial type3;
estimate "&var" &var 1 / exp;
run;
proc genmod data=&data descending;
class &var (ref='1') / param=ref;
model &outcome = &var / link=logit dist=binomial type3;
estimate "OR 3039" &var 1 / exp;
estimate "OR 4049" &var 0 1 / exp;
estimate "OR 5059" &var 0 0 1 / exp;
estimate "OR 6069" &var 0 0 0 1 / exp;
estimate "OR 7079" &var 0 0 0 0 1 / exp;
estimate "OR 80+" &var 0 0 0 0 0 1 / exp;
run;
proc genmod data=out.cohort6 descending;
class &var (ref='2') / param=ref;
model &outcome = &var / link=logit dist=binomial;
estimate "OR Public" &var 1 / exp;
estimate "OR Other" &var 0 1 / exp;
run;
proc sort data=&data out=sort;
by &strata;
run;
proc genmod data=sort descending;
by &strata;
class &var (ref='1') / param=ref;
model &outcome = &var / link=logit dist=binomial type3;
estimate "OR q2" &var 1 / exp;
estimate "OR q3" &var 0 1/ exp;
estimate "OR q4" &var 0 0 1 / exp;
run;
Bailey DeBarmore is a doctoral student at the University of North Carolina at Chapel Hill studying epidemiology. Find her on Twitter@BaileyDeBarmore and blogging for the American Heart Association on the Early Career Voice blog. 
import zepid as ze
import matplotlib.pyplot as plt
df = ze.load_sample_data(timevary=False)
ze.graphics.func_form_plot(df,outcome='dead',var='age0',discrete=True)
plt.show()
Warning: missing observations of model variables are dropped
0 observations were dropped from the functional form assessment
Generalized Linear Model Regression Results
==============================================================================
Dep. Variable: dead No. Observations: 547
Model: GLM Df Residuals: 545
Model Family: Binomial Df Model: 1
Link Function: logit Scale: 1.0000
Method: IRLS LogLikelihood: 239.25
Date: Tue, 26 Jun 2018 Deviance: 478.51
Time: 08:25:47 Pearson chi2: 553.
No. Iterations: 5 Covariance Type: nonrobust
==============================================================================
coef std err z P>z [0.025 0.975]

Intercept 3.6271 0.537 6.760 0.000 4.679 2.575
age0 0.0507 0.013 4.012 0.000 0.026 0.075
==============================================================================
AIC: 482.50783872152573
BIC: 2957.4167585984537
df[['rqs0','rqs1']] = ze.spline(df,var='age0',n_knots=3,knots=[30,40,50],restricted=True)
ze.graphics.func_form_plot(df,outcome='dead',var='age0',f_form='age0 + rqs0 + rqs1',discrete=True)
plt.vlines(30,0,0.85,colors='gray',linestyles='')
plt.vlines(40,0,0.85,colors='gray',linestyles='')
plt.vlines(55,0,0.85,colors='gray',linestyles='')
plt.show()
#Loading necessary packages to fit model
import zepid as ze
import statsmodels.api as sm
import statsmodels.formula.api as smf
from statsmodels.genmod.families import family,links
#Loading the example data within zEpid
df = ze.load_sample_data(timevary=False)
#Creating polynomial terms
df['cd40sq'] = df['cd40']**2
df['cd40cu'] = df['cd40']**3
#Generating stabilized IPTW for ART as exposure
model = 'male + age0 + cd40 + cd40sq + cd40cu + dvl0'
df['iptw'] = ze.ipw.iptw(df,treatment='art',model_denominator=model,stabilized=True)
#Fitting a GEE model with the statsmodels library to obtain the risk of death by ART exposure (Risk Difference)
ind = sm.cov_struct.Independence()
f = sm.families.family.Binomial(sm.families.links.identity)
linrisk = smf.gee('dead ~ art',df['id'],df,cov_struct=ind,family=f,weights=df['iptw']).fit()
print(linrisk.summary())
GEE Regression Results
===================================================================================
Dep. Variable: dead No. Observations: 547
Model: GEE No. clusters: 547
Method: Generalized Min. cluster size: 1
Estimating Equations Max. cluster size: 1
Family: Binomial Mean cluster size: 1.0
Dependence structure: Independence Num. iterations: 2
Date: Tue, 26 Jun 2018 Scale: 1.000
Covariance type: robust Time: 13:56:22
==============================================================================
coef std err z P>z [0.025 0.975]

Intercept 0.1817 0.018 10.008 0.000 0.146 0.217
art 0.0826 0.037 2.205 0.027 0.156 0.009
==============================================================================
Skew: 1.7574 Kurtosis: 1.1278
Centered skew: 0.0000 Centered kurtosis: 3.0000
==============================================================================
pip install zepid
In the background, zEpid uses:
 If you are interested in conducting analyses in Python, I also recommend the packages:

Paul Zivich is an epidemiology PhD student at University of North Carolina at Chapel Hill. His interests include infectious disease epidemiology and causal inference in the presence of interference. To request features or ask questions, contact him on GitHub at /pzivich/zepid, on Twitter @zEpidpy, or by email. 
avg_bp=mean(bp1bp3)
avg_bp=average(bp1bp3)
avg_bp=mean(of bp1bp3)
avg_bp=SUM(of bp1bp3)/3
NEWVAR = mean(of VAR1VAR3)
NEWVAR = mean(VAR1, VAR2, VAR3)
Bailey DeBarmore is a doctoral student at the University of North Carolina at Chapel Hill studying epidemiology. Find her on Twitter @BaileyDeBarmore and blogging for the American Heart Association on the Early Career Voice blog. 
tab diabetes agegrp, col
nptrend diabetes, by(agegrp)
sort male
by male: tab diabetes agegrp, col
nptrend diabetes if male==0, by(agegrp)
nptrend diabetes if male==1, by (agegrp)
tabstat bmi, by(agegrp) stats(mean sd) format(%9.2f)
nptrend bmi, by(agegrp)
sort male
by male: tabstat bmi, by(agegrp) stats(mean sd) format(%9.2f)
nptrend bmi if male==0, by(agegrp)
nptrend bmi if male==1, by(agegrp)
anova bmi agegrp race
regress bmi i.agegrp race
contrast r.agegrp
contrast a.agegrp
contrast ar.agegrp
contrast p.agegrp, noeffects
logit diabetes i.agegrp race bmi
contrast p.agegrp, noeffects
logistic diabetes i.agegrp race bmi
contrast p.agegrp, noeffects
PROC FREQ data=[data];
TABLES row * col / trend;
run;
PROC FREQ data=stroke;
TABLES diabetes * agegrp / trend;
run;
PROC NPAR1WAY data=stroke WILCOXON;
CLASS agegrp;
VAR bmi;
*exact wilcoxon;
run;
PROC LOGISTIC data=[data];
MODEL diabetes = agegrp bmi race;
TEST agegrp;
run;
Bailey DeBarmore is a doctoral student at the University of North Carolina at Chapel Hill studying epidemiology. Find her on Twitter @BaileyDeBarmore and blogging for the American Heart Association on the Early Career Voice blog. 