Hello,
I am trying to export survey data from REDCap to SAS (version 9.4). After following the instructions (from REDCap) in the picture below, I opened the SAS dataset only to find that there were zero observations (i.e. no participant responses) and only variables available in the SAS dataset. However, after opening the CSV file generated by REDCap, there was no missing data. I'm not sure whether this is an issue with SAS software, or if I'm doing something wrong when exporting the data. I would greatly appreciate some insight into why SAS is reading that there are zero observations in the dataset, but the CSV file reads otherwise. Thanks!
The whole filename (including the complete path) needs to be enclosed in quotes.
The .SAS file is the program to read the CSV file into SAS and to create the SAS data set.
So you ran the SAS file in SAS, after updating the path per the instructions below and it generated no data?
Was the log error free after running the code? Can you post the log - be careful not to include any identifying information in the log please.
@ABO28 wrote:
Hello,
I am trying to export survey data from REDCap to SAS (version 9.4). After following the instructions (from REDCap) in the picture below, I opened the SAS dataset only to find that there were zero observations (i.e. no participant responses) and only variables available in the SAS dataset. However, after opening the CSV file generated by REDCap, there was no missing data. I'm not sure whether this is an issue with SAS software, or if I'm doing something wrong when exporting the data. I would greatly appreciate some insight into why SAS is reading that there are zero observations in the dataset, but the CSV file reads otherwise. Thanks!
Yes, I ran the SAS file in SAS after updating the path and no data was generated. I noticed a few errors in the log, but I'm not exactly sure what the errors mean. It seems there may be an error with the location of the CSV file, but I copied the location straight from the properties tab in "My Documents". The log is very long, so I copy and pasted lines indicating error. I hope this will suffice.
1 /* Edit the following line to reflect the full path to your CSV file */
2 %let csv_file = C:\Users\identifiable\Desktop\Aim 2
2 ! analysis\'Studyname.csv';
3
4 OPTIONS nofmterr;
5
6 proc format;
7 value consent_version_ 0='Prior to V6' 6='v6 10/26/2020';
NOTE: Format CONSENT_VERSION_ has been output.
436
437 data work.redcap; %let _EFIERR_ = 0;
438 infile &csv_file delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=1 ;
NOTE: Line generated by the macro variable "CSV_FILE".
1 C:\Users\identifiable\Desktop\Aim 2
-
23
ERROR 23-2: Invalid option name :.
1 ! C:\Users\identifiable\Desktop\Aim 2
-----
23
ERROR 23-2: Invalid option name USERS.
1 ! C:\Users\identifiable\Desktop\Aim 2
-------
23
ERROR 23-2: Invalid option name IDENTIFIABLE.
1 ! C:\Users\identifiable\Desktop\Aim 2
-------
23
ERROR 23-2: Invalid option name DESKTOP.
1 ! C:\Users\identifiable\Desktop\Aim 2
---
23
ERROR 23-2: Invalid option name AIM.
1 ! C:\Users\identifiable\Desktop\Aim 2
1 ! analysis\'Studyname.csv'
--------
23
ERROR 23-2: Invalid option name ANALYSIS.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.REDCAP may be incomplete. When this step was stopped there were 0
observations and 197 variables.
NOTE: DATA statement used (Total process time):
real time 0.26 seconds
cpu time 0.21 seconds
NOTE: There were 0 observations read from the data set WORK.REDCAP.
NOTE: The data set WORK.REDCAP has 0 observations and 197 variables.
NOTE: DATA statement used (Total process time):
real time 0.41 seconds
cpu time 0.32 seconds
1430
1431 proc contents data=redcap;
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds
1432 proc print data=redcap;
1433 run;
NOTE: No observations in data set WORK.REDCAP.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.17 seconds
cpu time 0.17 seconds
The whole filename (including the complete path) needs to be enclosed in quotes.
Great. Thank you so much!
I have recently published a macro to export REDCap data into SAS along with formats and a data dictionary. Please see my paper, presentation, and code by filling out this survey: https://redcap.link/REDCapIsMySASFriend.
Distribution using this method allows me to distribute only the most recent version, so you can check back to this survey in the future as well.
Also available on LexJansen under SESUG 2022. "REDCap: Your SAS Friend for EHR Manual Abstraction"
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.