mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2024-11-22 13:30:23 +01:00
Closes #3. SAS now handles instrument status fields
This commit is contained in:
parent
57a0538a11
commit
3f891fcfef
@ -49,9 +49,8 @@
|
|||||||
|
|
||||||
|
|
||||||
%MACRO REDCAP_SPLIT(
|
%MACRO REDCAP_SPLIT(
|
||||||
DATA_DICTIONARY = REDCAP_DATA_DICTIONARY /* The name of the SAS dataset of the data dictionary */,
|
|
||||||
DATA_SET = REDCAP /* The name of the SAS dataset created by REDCap */,
|
DATA_SET = REDCAP /* The name of the SAS dataset created by REDCap */,
|
||||||
KEY = RECORD_ID /* Variable that links base table with other tables */
|
DATA_DICTIONARY = REDCAP_DATA_DICTIONARY /* The name of the SAS dataset of the data dictionary */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Remove formatting from repeat instrument field */
|
/* Remove formatting from repeat instrument field */
|
||||||
@ -83,13 +82,23 @@
|
|||||||
|
|
||||||
%IF &N_SUBTABLES GT 0 %THEN %DO;
|
%IF &N_SUBTABLES GT 0 %THEN %DO;
|
||||||
|
|
||||||
/* Make a list of fields and their associated forms based on data dictionary */
|
/* Get information on the variables in the dataset */
|
||||||
PROC CONTENTS
|
PROC CONTENTS
|
||||||
DATA = &DATA_SET.
|
DATA = &DATA_SET.
|
||||||
OUT = REDCAP_VARNAMES(KEEP=NAME)
|
OUT = REDCAP_VARNAMES(KEEP=NAME VARNUM)
|
||||||
NOPRINT;
|
NOPRINT;
|
||||||
RUN;
|
RUN;
|
||||||
|
|
||||||
|
/* Find the key that links the base table to child tables */
|
||||||
|
DATA _NULL_;
|
||||||
|
SET REDCAP_VARNAMES;
|
||||||
|
IF VARNUM EQ 1 THEN DO;
|
||||||
|
CALL SYMPUT("KEY", NAME);
|
||||||
|
STOP;
|
||||||
|
END;
|
||||||
|
RUN;
|
||||||
|
|
||||||
|
/* Make a list of fields and their associated forms based on data dictionary */
|
||||||
DATA REDCAP_FIELDS(KEEP=VAR_NAME FORM_NAME);
|
DATA REDCAP_FIELDS(KEEP=VAR_NAME FORM_NAME);
|
||||||
SET &DATA_DICTIONARY.;
|
SET &DATA_DICTIONARY.;
|
||||||
IF FIELD_TYPE EQ "checkbox" THEN DO;
|
IF FIELD_TYPE EQ "checkbox" THEN DO;
|
||||||
@ -104,6 +113,20 @@
|
|||||||
END;
|
END;
|
||||||
ELSE OUTPUT;
|
ELSE OUTPUT;
|
||||||
RUN;
|
RUN;
|
||||||
|
|
||||||
|
/* Add instrument status fields to list of fields */
|
||||||
|
PROC SQL;
|
||||||
|
|
||||||
|
CREATE TABLE REDCAP_INSTRUMENT_STATUS_FIELDS AS
|
||||||
|
SELECT DISTINCT TRIM(FORM_NAME)!!"_complete" AS VAR_NAME LENGTH=200, FORM_NAME
|
||||||
|
FROM REDCAP_DATA_DICTIONARY;
|
||||||
|
|
||||||
|
QUIT;
|
||||||
|
|
||||||
|
PROC APPEND
|
||||||
|
BASE=REDCAP_FIELDS
|
||||||
|
DATA=REDCAP_INSTRUMENT_STATUS_FIELDS;
|
||||||
|
RUN;
|
||||||
|
|
||||||
/* Sort out the field names */
|
/* Sort out the field names */
|
||||||
PROC SQL NOPRINT;
|
PROC SQL NOPRINT;
|
||||||
@ -151,6 +174,11 @@
|
|||||||
|
|
||||||
%END;
|
%END;
|
||||||
|
|
||||||
|
/* Clean up temporary datasets */
|
||||||
|
PROC DATASETS MEMTYPE=DATA LIBRARY=WORK NOLIST;
|
||||||
|
DELETE REDCAP_FIELDS REDCAP_VARNAMES REDCAP_INSTRUMENT_STATUS_FIELDS;
|
||||||
|
RUN;
|
||||||
|
|
||||||
%END;
|
%END;
|
||||||
|
|
||||||
%ELSE %DO;
|
%ELSE %DO;
|
||||||
|
Loading…
Reference in New Issue
Block a user