Skip to content

Commit 09a5955

Browse files
authored
Merge pull request #42 from lexjansen/github_issue_27_xptv8
GitHub issue 27 xptv8
2 parents 6c6c0d8 + f9c805d commit 09a5955

File tree

5 files changed

+129
-49
lines changed

5 files changed

+129
-49
lines changed

data/send_xpt/bg.xpt

0 Bytes
Binary file not shown.

data/send_xpt/bw.xpt

0 Bytes
Binary file not shown.

data/send_xpt/lb.xpt

0 Bytes
Binary file not shown.

programs/01_convert_xpt.sas

+49-49
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
%* update this location to your own location;
2-
%let project_folder=/_github/lexjansen/dataset-json-sas;
3-
%include "&project_folder/programs/config.sas";
4-
5-
6-
%let _cst_rc=;
7-
%let _cst_rcmsg=;
8-
9-
/* Convert ADaM XPT files to SAS datasets */
10-
%cstutilxptread(
11-
_cstSourceFolder=&project_folder/data/adam_xpt,
12-
_cstOutputLibrary=dataadam,
13-
_cstExtension=XPT,
14-
_cstOptions=datecopy
15-
);
16-
/*
17-
proc contents data=dataadam._ALL_ varnum;
18-
run;
19-
*/
20-
21-
/* Convert SDTM XPT files to SAS datasets */
22-
%cstutilxptread(
23-
_cstSourceFolder=&project_folder/data/sdtm_xpt,
24-
_cstOutputLibrary=datasdtm,
25-
_cstExtension=XPT,
26-
_cstOptions=datecopy
27-
);
28-
/*
29-
proc contents data=datasdtm._ALL_ varnum;
30-
run;
31-
*/
32-
33-
/* Convert SEND XPT files to SAS datasets */
34-
%cstutilxptread(
35-
_cstSourceFolder=&project_folder/data/send_xpt,
36-
_cstOutputLibrary=datasend,
37-
_cstExtension=XPT,
38-
_cstOptions=datecopy
39-
);
40-
/*
41-
proc contents data=datasend._ALL_ varnum;
42-
run;
43-
*/
44-
45-
/*
46-
libname dataadam clear;
47-
libname datasdtm clear;
48-
libname datasend clear;
49-
*/
1+
%* update this location to your own location;
2+
%let project_folder=/_github/lexjansen/dataset-json-sas;
3+
%include "&project_folder/programs/config.sas";
4+
5+
6+
%let _cst_rc=;
7+
%let _cst_rcmsg=;
8+
9+
/* Convert ADaM v5 XPT files to SAS datasets */
10+
%cstutilxptread(
11+
_cstSourceFolder=&project_folder/data/adam_xpt,
12+
_cstOutputLibrary=dataadam,
13+
_cstExtension=XPT,
14+
_cstOptions=datecopy
15+
);
16+
/*
17+
proc contents data=dataadam._ALL_ varnum;
18+
run;
19+
*/
20+
21+
/* Convert SDTM v5 XPT files to SAS datasets */
22+
%cstutilxptread(
23+
_cstSourceFolder=&project_folder/data/sdtm_xpt,
24+
_cstOutputLibrary=datasdtm,
25+
_cstExtension=XPT,
26+
_cstOptions=datecopy
27+
);
28+
/*
29+
proc contents data=datasdtm._ALL_ varnum;
30+
run;
31+
*/
32+
33+
/* Convert SEND v5 XPT files to SAS datasets */
34+
%cstutilxptread(
35+
_cstSourceFolder=&project_folder/data/send_xpt,
36+
_cstOutputLibrary=datasend,
37+
_cstExtension=XPT,
38+
_cstOptions=datecopy
39+
);
40+
/*
41+
proc contents data=datasend._ALL_ varnum;
42+
run;
43+
*/
44+
45+
/*
46+
libname dataadam clear;
47+
libname datasdtm clear;
48+
libname datasend clear;
49+
*/

programs/01_convert_xpt2loc.sas

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
%* update this location to your own location;
2+
%let project_folder=/_github/lexjansen/dataset-json-sas;
3+
%include "&project_folder/programs/config.sas";
4+
5+
/* Convert ADaM v5 or v8 XPT files to SAS datasets */
6+
%util_gettree(
7+
dir=&project_folder/data/adam_xpt,
8+
outds=work.dirtree_adam,
9+
where=%str(ext="xpt" and dir=0)
10+
);
11+
12+
%if %cstutilnobs(_cstDataSetName=work.dirtree_adam)=0 %then %do;
13+
%put WAR%str(NING): No XPT files to read in directory %sysfunc(pathname(dataadam)).;
14+
%end;
15+
16+
data _null_;
17+
length code $2048;
18+
set work.dirtree_adam;
19+
datasetname=scan(filename, 1, ".");
20+
code=cats('%nrstr(%xpt2loc('
21+
, "filespec='", fullpath, "',"
22+
, 'libref=dataadam,'
23+
, 'memlist=', datasetname
24+
,');)');
25+
call execute(code);
26+
run;
27+
28+
/* Convert SDTM XPT v5 or v8 files to SAS datasets */
29+
%util_gettree(
30+
dir=&project_folder/data/sdtm_xpt,
31+
outds=work.dirtree_sdtm,
32+
where=%str(ext="xpt" and dir=0)
33+
);
34+
35+
%if %cstutilnobs(_cstDataSetName=work.dirtree_sdtm)=0 %then %do;
36+
%put WAR%str(NING): No XPT files to read in directory %sysfunc(pathname(datasdtm)).;
37+
%end;
38+
39+
40+
data _null_;
41+
length code $2048;
42+
set work.dirtree_sdtm;
43+
datasetname=scan(filename, 1, ".");
44+
code=cats('%nrstr(%xpt2loc('
45+
, "filespec='", fullpath, "',"
46+
, 'libref=datasdtm,'
47+
, 'memlist=', datasetname
48+
,');)');
49+
call execute(code);
50+
run;
51+
52+
/* Convert SEND XPT v5 or v8 files to SAS datasets */
53+
%util_gettree(
54+
dir=&project_folder/data/send_xpt,
55+
outds=work.dirtree_send,
56+
where=%str(ext="xpt" and dir=0)
57+
);
58+
59+
%if %cstutilnobs(_cstDataSetName=work.dirtree_send)=0 %then %do;
60+
%put WAR%str(NING): No XPT files to read in directory %sysfunc(pathname(datasend)).;
61+
%end;
62+
63+
64+
data _null_;
65+
length code $2048;
66+
set work.dirtree_send;
67+
datasetname=scan(filename, 1, ".");
68+
code=cats('%nrstr(%xpt2loc('
69+
, "filespec='", fullpath, "',"
70+
, 'libref=datasend,'
71+
, 'memlist=', datasetname
72+
,');)');
73+
call execute(code);
74+
run;
75+
76+
/*
77+
libname dataadam clear;
78+
libname datasdtm clear;
79+
libname datasend clear;
80+
*/

0 commit comments

Comments
 (0)