将SAS代码转换为R代码 [英] Translate SAS code to R code

查看:297
本文介绍了将SAS代码转换为R代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

提前感谢,需要将以下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并且可以帮助翻译给你。

但是这个帖子有点旧了。

所以,如果它仍然是实际的,请通过邮件给我写信:

bestuser@mail.ru ,主题:'sas into R'



谢谢,



步骤0;

#get data into R





步骤1;

/ *获取所有不同的主要信息来自CMS数据* /

cms_filter< - data.frame(main_cpt = unique(cms
Hi,
I know both SAS and R and can help translate it to you.
But this post a little old.
So if it is still actual, please, write me via mail:
bestuser@mail.ru, topic: 'sas into R'

Thanks,

Step 0;
#get data into R


Step 1;
/*get all distinct main cpts from CMS data*/
cms_filter <- data.frame( main_cpt = unique( cms


main_cpt))
main_cpt ) )


这篇关于将SAS代码转换为R代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆