1 Star 0 Fork 0

yzw554350785/Programming-SAS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Rules_Count_OpenCDISC_XML.sas 3.81 KB
一键复制 编辑 原始数据 按行查看 历史
Jiangtang Hu 提交于 2012-03-31 13:41 . is_leap, test for logical operators
*************************************************************************************************;
*Program Name : Rules_Count_OpenCDISC_XML.sas *;
*Programmer Name : Jiangtang Hu *;
* Jiangtanghu@gmail.com *;
* Jiangtanghu.com/blog *;
* *;
*Purpose : Count number of rules in OpenCDISC by modules *;
* *;
*Input : dir - OpenCDISC software installation directory *;
*Output : Frequency tables of number of rules in OpenCDISC by modules *;
*Usage : %Rules_Count_OpenCDISC_XML(dir=C:\Temp\opencdisc-validator\config) *;
* *;
* *;
*License : public domain, ABSOLUTELY NO WARRANTY *;
*Platform : tested in WinXP SAS/Base 9.2 and Win64 SAS/Base 9.3 *;
*Version : V1.0 *;
*Date : 19Feb2012 *;
*************************************************************************************************;
%macro Rules_Count_OpenCDISC_XML(dir=C:\Temp\opencdisc-validator\config);
/*get XML files list from OpenCDISC directory*/
filename XMLList pipe "dir /B &dir\*.xml";
data XMLList;
length XMLName $40;
infile XMLList length=reclen;
input XMLName $varying40. reclen;
run;
data _null_;
set XMLList end=eof;
II=left(put(_n_,2.));
call symputx('XMLName'||II,compress(XMLName));
if eof then call symputx('total',II);
run;
/*read OpenCDISC configuration files*/
%do i=1 %to &total;
%put &&XMLName&i;
filename module&i "&dir.\&&XMLName&i";
data XMLName&i;
length source $40;
infile module&i;
input;
text=_infile_;
if text = "" then delete;
order=&i;
source="&&XMLName&i";
temp=substr("&&XMLName&i",length("config-")+1,length("&&XMLName&i")-length("config-")-length(".xml"));
module=tranwrd(temp,"-"," ");
run;
data module&i;
length rule_id $6;
set XMLName&i;
if _n_ = 1 then do;
retain quename queCo1 queCo2;
data="/[A-Z]{2}\d{4}/";
comment1="/<!--/";
comment2="/-->/";
queName=prxparse(data);
queCo1=prxparse(comment1);
queCo2=prxparse(comment2);
if missing(queName) then do;
putlog "ERROR: Invalid regexp" data;
end;
if missing(queCo1) then do;
putlog "ERROR: Invalid regexp" queCo1;
end;
if missing(queCo2) then do;
putlog "ERROR: Invalid regexp" queCo2;
end;
end;
queNameN=prxmatch(queName,text);
queCo1N=prxmatch(queCo1,compress(text));
queCo2N=prxmatch(queCo2,compress(text));
*delete XML comments;
*rule OD0004, OD0005, OD0007, OD0008 are commented in config-define-1.0.xml;
if queCo1N > 0 or queCo2N > 0 then delete;
if quenamen > 0 then do;
rule_id=substr(text,quenamen,6);
keep order module rule_id source;
output;
end;
run;
proc sort nodup;
by rule_id;
run;
%end;
data CDISC;
set %do i=1 %to &total; module&i %end; ;
rule_type=substr(rule_id,1,2);
run;
proc sql;
select count(distinct rule_id) as rules_total_unique
from cdisc
;
quit;
proc freq data=cdisc;
tables module*rule_type /nopercent nocol norow;
run;
%mend Rules_Count_OpenCDISC_XML;
%*Rules_Count_OpenCDISC_XML;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yzw554350785/Programming-SAS.git
git@gitee.com:yzw554350785/Programming-SAS.git
yzw554350785
Programming-SAS
Programming-SAS
master

搜索帮助