Open warekj opened 5 years ago
Hi @warekj
Thanks for reaching out with this issue. Unfortunately, I am not aware of any way to allow SAS to accept variable names or table names greater than 32 character. As such, I had to get a little creative. This is a partial workaround that has some flaws and limitations, but I hope it will solve your current issue.
I have added a new parameter called NUMERIC_SUBTABLES
. If you set this to Y
, SAS will create a dataset with a numeric suffix, rather than the repeating instrument name as the suffix. A note will be made in the log which will help you associate the table names to right repeating instruments.
Please note that REDCap also allows for variable names greater than 32 characters. Therefore, some variables may be lost in this process, most notably the [instrument]_complete
variable. If you use the SAS syntax file to import the dataset, REDCap will handle long variable names by cutting them short and affixing a numeric suffix. Since I can't think of a clean way to re-associate those variable names with the original variable names, the only option is to remove them from the data entirely.
Take a look at the log after you run %REDCAP_SPLIT()
. I do my best to warn the user of any wrinkles that may have occurred because of the 32 character limitation. Meanwhile, I will attempt to think of a more elegant solution that will solve the problem completely.
You can try the fix in the branch called issue13
(see commit in thread).
Thanks
Thank you so much @pegeler . I re-ran the new SAS code with the new parameter 'NUMERIC_SUBTABLES=Y `, and it worked beautifully as all my repeat instrument tables and base table were created.
I do get a warning: WARNING: The variable <[instrument]_complete> in the DROP, KEEP, or RENAME list has never been referenced
for one of the [instrument]_complete variables in my dataset even though it is not over 32 characters long. I believe this is because it is renamed (as you mentioned above) by the REDCap SAS file cutting it short and affixing a numeric suffix. To fix this I simply changed the REDCap SAS file code to keep the variable's original name. I am not sure why it decided to cut it short as it was only 31 characters long.
Hello @warekj
I have attempted to reproduce the bug you described in your previous comment but could not. Please consider creating a minimum reproducible example using dummy data. I would be glad to debug from there. This repo has a test-data/ folder that you could put it in.
Thanks!
The SAS macro %REDCAP_SPLIT() results in an error when one of the redcap repeat instrument names is longer than 32 characters. As a result, the table for it is never created. Is there a way to change the length allowed for this SAS variable name within the macro?