SAS PROC SQL -- merging and calculation

proc sql ;
create table new as
select a._Material_Substance_Use_Abuse,
(a._1_Yes+a._2_No) as total_n, a._1_Yes as Yes_n, a._2_No as No_n,
a._3_Section_not_available as No_no_section,
(a._1_Yes/(a._1_Yes+a._2_No)) as YES_percentage_wo_sec,
(a._1_Yes/(a._1_Yes+a._2_No+a._3_Section_not_available)) as YES_percentage_w_sec
from Eye_twoT1 AS a
;

SAS PROC SQL

Get the number of distinct values.

proc sql;
create table temp2 as select *,
count(distinct ID) as duplic
from final.cleaned
group by Case_num;
run;

R purrr

library(tidyverse)

my_list<-list(
c(1,2,6),
c(4,7,1),
c(9,1,5)
)

my_list[[1]] %>% mean()
my_list %>% map_dbl(mean)
map(my_list,mean)
my_list %>% map(~ . *1)
my_list %>% map(~ . *2)

pop<-rnorm(10000)
n<-1:1000
m1<-rep(NA,length(n))

for (i in n){
x<-sample(pop,i)
m1[i]<-mean(x)
}
plot(m1,type="l")