Skip to content

Commit

Permalink
Merge pull request #129 from UCL/Loveleen
Browse files Browse the repository at this point in the history
Update hiv_synthesis.sas
  • Loading branch information
LoveleenB-M authored Feb 26, 2021
2 parents 557e20b + dee272c commit 689bf42
Showing 1 changed file with 25 additions and 38 deletions.
63 changes: 25 additions & 38 deletions hiv_synthesis.sas
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ prob_prep_restart=1.00; * set to 1 given we have rate_test_restartprep; *Probabi
prob_prep_visit_counsel=0; *Probability of PrEP adherence counselling happening at drug pick-up;
prob_prep_restart_choice=0.10; * probability of restarting PrEP after discontinuation even when newp>1;
* dependent_on_time_step_length ;
prepuptake_sw=0.50; *Probability of PrEP uptake if eligible for female sex workers;
prepuptake_pop=0.20; **Probability of PrEP uptake if eligible for general population;
pop_wide_tld_prob_egfr=0.5; * probability per 3 months of getting egfr test when pop_wide_tld_prep=1 when indicated (annually);
* dependent_on_time_step_length ;
Expand Down Expand Up @@ -725,8 +724,8 @@ p_neph_stops_after_ten = 0.1;
if e >= 0.66 then effect_sw_prog_adh=1;
* effect_sw_prog_lossdiag; e=uniform(0); if e < 0.33 then effect_sw_prog_lossdiag=0.80; if 0.33 <= e < 0.66 then effect_sw_prog_lossdiag=0.60;
if e >= 0.66 then effect_sw_prog_lossdiag=0.40;
* effect_sw_prog_prep; e=uniform(0); if e < 0.33 then effect_sw_prog_prep=0.60; if 0.33 <= e < 0.66 then effect_sw_prog_prep=0.75;
if e >= 0.66 then effect_sw_prog_prep=0.90;
* effect_sw_prog_prep; e=uniform(0);if e < 0.50 then effect_sw_prog_prep=0.95; if e >= 0.50 then effect_sw_prog_prep=0.80;


* tb_base_prob_diag_l; e=uniform(0); if e < 0.333 then tb_base_prob_diag_l=0.25; if 0.333 <= e < 0.666 then tb_base_prob_diag_l=0.50;
if e >= 0.666 then tb_base_prob_diag_l=0.75;
Expand Down Expand Up @@ -765,9 +764,9 @@ p_neph_stops_after_ten = 0.1;
* prob_prep_restart_choice; r=uniform(0); if r < 0.33 then prob_prep_restart_choice=0.05; if 0.33 <= r < 0.67 then prob_prep_restart_choice=0.10;
if 0.67 <= r then prob_prep_restart_choice=0.20;
* dependent_on_time_step_length ;

* prepuptake_sw; r=uniform(0); prepuptake_sw=0.5; if r > 0.8 then prepuptake_sw =0.10; if r < 0.2 then prepuptake_sw = 0.80;

* prepuptake_pop; r=uniform(0); prepuptake_pop=0.2; if r > 0.8 then prepuptake_pop =0.10; if r < 0.2 then prepuptake_pop = 0.5 ;
* add_prepuptake_sw; add_prepuptake_sw=0; ***this may be sampled at a later date;

* note there are three parameters that affect use of prep besides the prep_strategy - prob_prep_b is prob of starting if prep_elig=1 and tested=1
and prep_willing = 1 - a person cannot be prep_elig=1 if hard_reach=1 - a person prep_elig=1 will only actually have a chance of starting prep
Expand Down Expand Up @@ -1612,7 +1611,6 @@ eff_sw_higher_int = sw_higher_int;
eff_prob_sw_lower_adh = prob_sw_lower_adh;
eff_sw_higher_prob_loss_at_diag = sw_higher_prob_loss_at_diag;
sw_program_visit=0;
eff_prepuptake_sw=prepuptake_sw;

* na defines a "non-adherent person" - not sure if this is reasonable structure for non adherence;

Expand Down Expand Up @@ -1806,11 +1804,7 @@ if adh_pattern_prep=4 then adhav_pr = adhav*0.50;


* willingness to take prep if offered;
r1=uniform(0); prep_willing_pop = 0; if r1 < prepuptake_pop then prep_willing_pop =1;
if gender=2 then do;
r2=uniform(0); prep_willing_sw = prep_willing_pop;
if prep_willing_pop=0 and r2 < (prepuptake_sw-prepuptake_pop)/(1-prepuptake_pop) then prep_willing_sw =1;
end;
r1=uniform(0); prep_willing = 0; if r1 < prepuptake_pop then prep_willing =1;

hiv=0;
nip=0;
Expand Down Expand Up @@ -2037,8 +2031,7 @@ if sw_program_visit=0 then do; e=uniform(0);
eff_sw_higher_int = sw_higher_int * effect_sw_prog_int;
eff_prob_sw_lower_adh = prob_sw_lower_adh / effect_sw_prog_adh ;
eff_sw_higher_prob_loss_at_diag = sw_higher_prob_loss_at_diag * effect_sw_prog_lossdiag;
eff_prepuptake_sw=effect_sw_prog_prep;
s= uniform(0); if s < eff_prepuptake_sw and prep_willing_sw = 0 then prep_willing_sw = 1;
s= uniform(0); if s < effect_sw_prog_prep and prep_willing = 0 then prep_willing = 1;
end;
end;
end;
Expand All @@ -2051,7 +2044,6 @@ else if sw_program_visit=1 then do; e=uniform(0);
eff_sw_higher_int = sw_higher_int;
eff_prob_sw_lower_adh = prob_sw_lower_adh;
eff_sw_higher_prob_loss_at_diag = sw_higher_prob_loss_at_diag ;
eff_prepuptake_sw=prepuptake_sw;
end;

end;
Expand Down Expand Up @@ -2157,17 +2149,13 @@ if higher_future_prep_cov=1 then do;
eff_prob_prep_restart_choice = round(eff_prob_prep_restart_choice, 0.01);
end;

* incr_prepuptake_sw_2020;
incr_prepuptake_sw_2020 = 0;
if _u34 < 0.95 then do; incr_prepuptake_sw_2020 = 1;
r= uniform(0); if r < 0.95 and prep_willing_sw = 0 then prep_willing_sw = 1;
end;


* incr_prepuptake_pop_2020;
incr_prepuptake_pop_2020 = 0;
if _u36 < 0.95 then do;
incr_prepuptake_pop_2020 = 1;
r= uniform(0); if r < 0.8 and prep_willing_pop = 0 then prep_willing_pop = 1;
r= uniform(0); if r < 0.8 and prep_willing = 0 then prep_willing = 1;
end;

* prep_strategy;
Expand Down Expand Up @@ -3313,6 +3301,10 @@ if gender = 2 and sw_tm1 = 0 then do;
if 20 <= age < 25 and life_sex_risk = 3 and e < base_rate_sw*rr_sw_life_sex_risk_3*sqrt(rred_rc) then sw=1;
if 25 <= age < 35 and life_sex_risk = 3 and e < base_rate_sw*rr_sw_age_2534*rr_sw_life_sex_risk_3*sqrt(rred_rc) then sw=1;
if 35 <= age < 50 and life_sex_risk = 3 and e < base_rate_sw*rr_sw_age_3549*rr_sw_life_sex_risk_3*sqrt(rred_rc) then sw=1;

if sw=1 then do; r=uniform(0);if prep_willing=0 and r < add_prepuptake_sw then prep_willing=1;end;
***currently SW are no more likely to be willing to take prep than gen pop;

end;

if ever_sw = 1 then do; * dependent_on_time_step_length ;
Expand All @@ -3331,6 +3323,7 @@ end;
end;



*initial distribution of newp for sw (need to define tm1 here in order to define number of current partners below);
if t ge 2 and sw_tm1 ne 1 and sw=1 then do;
e=uniform(0);
Expand Down Expand Up @@ -4069,7 +4062,7 @@ and ((testing_disrup_covid ne 1 or covid_disrup_affected ne 1 )) then do;
available with roll-out and interest of PrEP
do not differentiate the probabilty of testing whether they have a short-term or long-term partner;

if prep_ever ne 1 and tested ne 1 and prep_elig=1 and (prep_willing_pop=1 or (sw=1 and prep_willing_sw=1 )) then do;
if prep_ever ne 1 and tested ne 1 and prep_elig=1 and prep_willing=1 then do;
a=uniform(0); if a < eff_rate_test_startprep then do;
tested=1;ever_tested=1;testfor_prep=1;dt_last_test=caldate{t};np_lasttest=0;
end;
Expand Down Expand Up @@ -4133,18 +4126,12 @@ if t ge 4 and caldate{t} ge date_prep_intro and registd ne 1 and prep_elig=1 the
*it was tested_tm1=1 and hiv_tm1=0. Now changed to tested=1 and commented out hiv_tm1=0 because
we want people who are false negative to also start PrEP, this is the reason why hiv=0 is now commented out;
if prep_ever ne 1 and tested=1 and (hiv=0 or (hiv=1 and unisensprep > sens_vct)) then do;
if sw = 1 then do;
if prep_willing_sw=1 then do;
if testfor_prep = 1 then do; prep =1; prep_ever=1; continuous_prep_use=0.25; dt_prep_s=caldate{t}; dt_prep_e=caldate{t};end;
else if testfor_prep ne 1 then do;r=uniform(0); if r < prob_prep_b then do; prep =1; prep_ever=1; dt_prep_s=caldate{t}; dt_prep_e=caldate{t};end; end;
end;
end;
else if sw ne 1 then do;
if prep_willing_pop=1 then do;

if prep_willing=1 then do;
if testfor_prep = 1 then do;prep =1; prep_ever=1; continuous_prep_use=0.25; dt_prep_s=caldate{t}; dt_prep_e=caldate{t};end;
else if testfor_prep ne 1 then do;r=uniform(0); if r < prob_prep_b then do; prep =1; prep_ever=1; dt_prep_s=caldate{t}; dt_prep_e=caldate{t};end; end;
end;
end;

started_prep_hiv_test_sens=0;if prep =1 and (hiv=1 and unisensprep > sens_vct) then do; started_prep_hiv_test_sens=1;started_prep_hiv_test_sens_e=1;end;
end;
* continuing PrEP;
Expand Down Expand Up @@ -4202,10 +4189,10 @@ if pop_wide_tld=1 and prep=1 then pop_wide_tld_prep=1;
if pop_wide_tld = 1 and registd ne 1 and ( prep_elig = 1 or ( ever_newp = 1 and ever_tested ne 1 ) ) then do;

if prep_ever ne 1 then do; * dependent_on_time_step_length;
r=uniform(0); if (prep_willing_pop=1 or (sw=1 and prep_willing_sw=1 )) and r < prob_prep_pop_wide_tld then do ;
r=uniform(0); if prep_willing=1 and r < prob_prep_pop_wide_tld then do ;

* ts1m ; * replace line above with this:
* r=uniform(0); * if (prep_willing_pop=1 or (sw=1 and prep_willing_sw=1 )) and r < ( 1 - (1 - prob_prep_pop_wide_tld)**(1/3) ) then do ;
* r=uniform(0); * if prep_willing=1 and r < ( 1 - (1 - prob_prep_pop_wide_tld)**(1/3) ) then do ;

prep =1; pop_wide_tld_prep=1; prep_ever=1; dt_prep_s=caldate{t}; dt_prep_e=caldate{t};
end;
Expand Down Expand Up @@ -14295,7 +14282,7 @@ if 15 <= age < 65 and (death = . or caldate&j = death ) then do;
s_onprep_12_i_prep_no_r + onprep_12_i_prep_no_r ; s_onprep_18_i_prep_no_r + onprep_18_i_prep_no_r ; s_prepinfect_rm_p + prepinfect_rm_p ;
s_prepinfect_m184m_p + prepinfect_m184m_p ; s_prepinfect_k65m_p + prepinfect_k65m_p ; s_prepinfect_tam_p + prepinfect_tam_p ;
s_prepinfect_rtm + prepinfect_rtm ; s_prepinfect_k65m + prepinfect_k65m ; s_prepinfect_m184m + prepinfect_m184m ; s_prepinfect_tam + prepinfect_tam ;
s_prep_willing_pop + prep_willing_pop ; s_prep_willing_sw + prep_willing_sw ; s_stop_prep_choice + stop_prep_choice ;
s_prep_willing + prep_willing ; s_stop_prep_choice + stop_prep_choice ;
s_started_prep_hiv_test_sens + started_prep_hiv_test_sens ; s_cur_res_prep_drug + cur_res_prep_drug ;
s_started_prep_hiv_test_sens_e + started_prep_hiv_test_sens_e ; s_started_prep_in_primary_e + started_prep_in_primary_e ;
s_cur_res_ten + cur_res_ten ; s_cur_res_3tc + cur_res_3tc ; s_i_65m + i_65m ; s_cur_res_efa + cur_res_efa ;
Expand Down Expand Up @@ -14326,7 +14313,7 @@ if 15 <= age < 65 and (death = . or caldate&j = death ) then do;
s_tested_4p_m4049_ + tested_4p_m4049_ ; s_tested_4p_m5064_ + tested_4p_m5064_ ; s_tested_4p_w1549_ + tested_4p_w1549_ ;
s_tested_4p_w1519_ + tested_4p_w1519_ ; s_tested_4p_w2024_ + tested_4p_w2024_ ; s_tested_4p_w2529_ + tested_4p_w2529_ ;
s_tested_4p_w3039_ + tested_4p_w3039_ ; s_tested_4p_w4049_ + tested_4p_w4049_ ; s_tested_4p_w5064_ + tested_4p_w5064_ ;
s_tested_4p_sw + tested_4p_sw ; s_tested_sw + tested_sw
s_tested_4p_sw + tested_4p_sw ; s_tested_sw + tested_sw;
s_ever_tested_m1549_ + ever_tested_m1549_ ; s_ever_tested_m1519_ + ever_tested_m1519_ ;
s_ever_tested_m2024_ + ever_tested_m2024_ ; s_ever_tested_m2529_ + ever_tested_m2529_ ; s_ever_tested_m3034_ + ever_tested_m3034_ ;
s_ever_tested_m3539_ + ever_tested_m3539_ ; s_ever_tested_m4044_ + ever_tested_m4044_ ; s_ever_tested_m4549_ + ever_tested_m4549_ ;
Expand Down Expand Up @@ -15582,7 +15569,7 @@ s_infected_prep_source_prep_r s_prepinfect_prep_r s_prepinfect_prep_r_p s
s_started_prep_in_primary s_tot_yrs_prep s_onprep_3_i_prep_no_r s_onprep_6_i_prep_no_r s_onprep_9_i_prep_no_r
s_onprep_12_i_prep_no_r s_onprep_18_i_prep_no_r s_prepinfect_rm_p s_prepinfect_m184m_p s_prepinfect_k65m_p
s_prepinfect_tam_p s_prepinfect_rtm s_prepinfect_k65m s_prepinfect_m184m s_prepinfect_tam
s_prep_willing_pop s_prep_willing_sw s_stop_prep_choice s_started_prep_hiv_test_sens
s_prep_willing s_stop_prep_choice s_started_prep_hiv_test_sens
s_cur_res_prep_drug s_started_prep_hiv_test_sens_e s_started_prep_in_primary_e
s_cur_res_ten s_cur_res_3tc s_i_65m s_cur_res_efa
s_cur_res_ten_vlg1000 s_cur_res_3tc_vlg1000 s_cur_res_efa_vlg1000 s_ever_hiv1_prep
Expand Down Expand Up @@ -16399,7 +16386,7 @@ s_infected_prep_source_prep_r s_prepinfect_prep_r s_prepinfect_prep_r_p s
s_started_prep_in_primary s_tot_yrs_prep s_onprep_3_i_prep_no_r s_onprep_6_i_prep_no_r s_onprep_9_i_prep_no_r
s_onprep_12_i_prep_no_r s_onprep_18_i_prep_no_r s_prepinfect_rm_p s_prepinfect_m184m_p s_prepinfect_k65m_p
s_prepinfect_tam_p s_prepinfect_rtm s_prepinfect_k65m s_prepinfect_m184m s_prepinfect_tam
s_prep_willing_pop s_prep_willing_sw s_stop_prep_choice s_started_prep_hiv_test_sens
s_prep_willing s_stop_prep_choice s_started_prep_hiv_test_sens
s_cur_res_prep_drug s_started_prep_hiv_test_sens_e s_started_prep_in_primary_e
s_cur_res_ten s_cur_res_3tc s_i_65m s_cur_res_efa
s_cur_res_ten_vlg1000 s_cur_res_3tc_vlg1000 s_cur_res_efa_vlg1000 s_ever_hiv1_prep
Expand Down Expand Up @@ -17016,7 +17003,7 @@ end;

data x; set cum_l1;

file "/home/rmjxxx/Scratch/_output_base_19_02_21_&dataset_id";
file "/home/rmjxxx/Scratch/_output_base_22_02_21_&dataset_id";

put

Expand Down Expand Up @@ -17226,7 +17213,7 @@ s_infected_prep_source_prep_r s_prepinfect_prep_r s_prepinfect_prep_r_p s
s_started_prep_in_primary s_tot_yrs_prep s_onprep_3_i_prep_no_r s_onprep_6_i_prep_no_r s_onprep_9_i_prep_no_r
s_onprep_12_i_prep_no_r s_onprep_18_i_prep_no_r s_prepinfect_rm_p s_prepinfect_m184m_p s_prepinfect_k65m_p
s_prepinfect_tam_p s_prepinfect_rtm s_prepinfect_k65m s_prepinfect_m184m s_prepinfect_tam
s_prep_willing_pop s_prep_willing_sw s_stop_prep_choice s_started_prep_hiv_test_sens
s_prep_willing s_stop_prep_choice s_started_prep_hiv_test_sens
s_cur_res_prep_drug s_started_prep_hiv_test_sens_e s_started_prep_in_primary_e
s_cur_res_ten s_cur_res_3tc s_i_65m s_cur_res_efa
s_cur_res_ten_vlg1000 s_cur_res_3tc_vlg1000 s_cur_res_efa_vlg1000 s_ever_hiv1_prep
Expand Down

0 comments on commit 689bf42

Please sign in to comment.