问题描述
提前感谢,需要将以下SAS代码翻译成R代码。这将是一个很大的帮助。
/ *从CMS数据中获取所有不同的主要cpts * /
proc sql;
create table cms_filter as
从cms中选择不同的main_cpt;
退出;
/ *获取编号和cpt代码来自CMS_filter的主要cpts的老化数据* /
proc sql;
创建表merge_1为
从老化中选择不同的enc_nbr,cpt4_code_id其中cpt4_code_id在
(从cms_filter中选择不同的main_cpt);
退出;
proc sql;
创建表aging_2为
选择a。*,b.cpt4_code_id作为main_cpt从老化作为
左连接
merge_1为b
on
a.enc_nbr = b.enc_nbr;
退出;
proc sql;
创建表格最终为
从
aging_2作为
加入
cms为b
on
a.min_cpt = b.main_cpt a nd
a.cpt4_code_id = b.child_cpt;
退出;
我尝试了什么:
我不认识SAS。所以,我自己无法工作
Thank you in advance, need to translate the below SAS code to R code. This would be for a great help.
/*get all distinct main cpts from CMS data*/
proc sql;
create table cms_filter as
select distinct main_cpt from cms;
quit;
/*Get the enc numbers and cpt code from the aging data for the main cpts from CMS_filter*/
proc sql;
create table merge_1 as
select distinct enc_nbr,cpt4_code_id from aging where cpt4_code_id in
(select distinct main_cpt from cms_filter);
quit;
proc sql;
create table aging_2 as
select a.*,b.cpt4_code_id as main_cpt from aging as a
left join
merge_1 as b
on
a.enc_nbr =b.enc_nbr ;
quit;
proc sql;
create table final as
select a.enc_nbr,b.main_cpt,b.child_cpt from
aging_2 as a
join
cms as b
on
a.min_cpt=b.main_cpt and
a.cpt4_code_id=b.child_cpt;
quit;
What I have tried:
I don't know SAS. So, couldn't work on my own
推荐答案
这篇关于将SAS代码转换为R代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!