-
Notifications
You must be signed in to change notification settings - Fork 4
/
3_Export_Filter.do
34 lines (27 loc) · 805 Bytes
/
3_Export_Filter.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
Using the REDCap API with Stata
Luke Stevens, Murdoch Childrens Research Institute
20-Jun-2017
3. Export_Filter.do
Specify an expression that will filter the records downloaded.
--form filterLogic="<expr>" // expression in REDCap syntax
*/
version 12
set more off
clear
local token "<insert your token here>"
local outfile "exported_data.csv"
shell c:\curl\curl.exe ///
--output `outfile' ///
--form token=`token' ///
--form content=record ///
--form format=csv ///
--form type=flat ///
--form filterLogic="[enrolment_arm_1][gender]='1'" ///
"https://redcap.mcri.edu.au/api/"
import delimited `outfile'
br
/**
Note this is equivalent to downloading all followed by
keep if redcap_event_name=="enrolment_arm_1" & gender==1
*/