Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEMO] Set the seed #194

Draft
wants to merge 3 commits into
base: core
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions hiv_synthesis.sas
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ libname a "&outputdir/";
%let population = 100000 ;
%let year_interv = 2021.5;

* Set this to 1 to get repeatable runs. It should be kept to 0 normally.;
%let run_with_fixed_seed = 0;

options ps=1000 ls=220 cpucount=4 spool fullstimer ;

/*
Expand Down Expand Up @@ -102,6 +105,15 @@ between 18-49 can be sampled using %sample_uniform(my_var, 18:49);
%mend sample_uniform;


/*
Macro for setting the seed if so specified.
This will do nothing if run_with_fixed_seed is set to 0 (the default).
*/
%macro fix_seed(seed);
%if &run_with_fixed_seed = 1 %then %do; call streaminit(&seed); %end;
%mend fix_seed;


* creating a file cum_l1 that will be used to save outputs at the end of running each loop of the model , i.e. every 3 months ;
data cum_l1;

Expand All @@ -121,6 +133,9 @@ One row of data defined, containing parameter values that remain fixed for the

data z;

* for reproducing a run;
%fix_seed(5);

run = rand('uniform')*1000000000; run=round(run,1);

dataset_id=trim(left(run));
Expand Down Expand Up @@ -985,6 +1000,8 @@ drop i;

data r1; set r1;

* for reproducing a run;
%fix_seed(10);

%sample_uniform(gender, 1 2);

Expand Down Expand Up @@ -17308,6 +17325,9 @@ s_prop_w_vlg5 s_prop_w_vlg6 s_prop_y181m s_sw s_w_newp ;

data r&da2; set r&da2;

* for reproducing a run;
%fix_seed(&j);

if age >= year_start;


Expand Down