I have two variable (0= negative, 1=positive) generated from two different Guidelines on HP, one is old published in 2021, and the other is updated in last year.
I want to estimated the Absolute Difference of Two Independent Proportions with the 95%CI as the Tables in JAMA Network Open(https://jamanetwork.com/journals/jam...cle/2687386). How can I do it efficiently?

I tried the commands:
I want if there are other user written commands to do it more efficient and flexible. Like:
The dataset is listed below:
I want to estimated the Absolute Difference of Two Independent Proportions with the 95%CI as the Tables in JAMA Network Open(https://jamanetwork.com/journals/jam...cle/2687386). How can I do it efficiently?
I tried the commands:
HTML Code:
proportion hp2024, cformat(%9.4f) scalar prop_2024 = r(table)["b",2] scalar se2024 = r(table)["se", 2] proportion hp2001, cformat(%9.4f) scalar prop_2001 = r(table)["b",2] scalar se2001 = r(table)["se", 2] scalar se=sqrt(se2024^2 +se2001^2 ) scalar z = invnormal(0.975) scalar p=prop_2001-prop_2024 scalar ci_lower = p - z * se scalar ci_upper = p + z * se format p ci_lower ci_upper %9.4f list p ci_lower ci_lower
HTML Code:
command_name hp2024 hp2001 command_name hp2024 hp2001 if sex==1 svy: command_name hp2024 hp2001
HTML Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte (hp2024 hp2001 sex) 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 0 0 2 0 0 1 1 1 2 0 1 2 1 1 1 0 0 2 0 0 2 1 1 1 1 1 2 1 1 1 0 0 1 0 1 2 0 0 1 0 0 2 0 0 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 0 1 1 0 0 2 0 0 2 1 1 2 1 1 2 0 0 2 0 0 1 0 0 1 1 1 2 1 1 2 1 1 2 0 0 2 0 0 2 1 1 1 0 0 2 1 1 1 1 1 1 0 0 1 0 0 2 1 1 1 1 1 1 1 1 2 1 1 1 0 0 2 0 0 2 0 0 2 1 1 2 1 1 2 1 1 2 0 1 1 0 0 2 0 0 1 0 1 1 0 0 1 0 0 1 1 1 1 1 1 1 0 0 2 0 0 2 0 0 1 1 1 1 1 1 2 0 0 2 0 0 2 0 1 2 1 1 1 0 0 2 0 0 2 1 1 1 0 1 1 1 1 1 0 0 1 0 1 2 0 0 1 1 1 1 0 1 1 1 1 1 1 1 2 0 1 1 0 0 2 0 0 2 0 1 2 0 0 2 0 1 1 0 1 1 0 1 1 0 0 2 0 0 2 0 0 2 1 1 2 1 1 1 0 1 2 end
Comment