BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hjjijkkl
Pyrite | Level 9

Hello;

I am trying to export data/report from sas to redcap and I am getting this error below. I tried to change my date to yymmdd10. but, Am still having a problem on understanding what the issues is. 

 

proc print data=stemp Noobs;
format start yymmdd10.;
run;

 

 

"error":"\"2-2c\",\"start\",\"11\/01\/2010 \",\"Invalid date format. (NOTE: Dates must be imported here only in Y-M-D H:M[:S] format, regardless of the specific date format designated for this field.) \"\n\"2-2j\",\"start\",\"10\/01\/2010 \",\"Invalid date format. (NOTE: Dates must be imported here only in Y-M-D H:M[:S] format, regardless of the specific date format designated for this field.)

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

I don't know if a format exits that appends fake-time information to a date. Most likely you will have to convert the date into a sas datetime before exporting it. You could use the function dhms.

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

That does not look like an error from SAS.  Not sure what REDCAP is but the error seems to be saying that you need to give it datetime strings in YMD HMS order, even if your values do not have any time component. People normally just use zeros for the time of day parts in that case.

 

You are just showing a PROC PRINT statement.  That will just write the data to a text file (or if you are using ODS some other file type like  EXCEL, RTF, etc).  What format does Redcap want the data?

 

SAS stores dates as the number of days since 1960 and datetime values as the number of seconds since 1960.  Your SAS code is assuming you have SAS date values so that the YYMMDD format can by used with it.  If your actual SAS variable has datetime values then you will not want to use the YYMMDD format as they value will be way too large. There are 24*60*60 seconds in a day.

hjjijkkl
Pyrite | Level 9
from the error it seems that redcap wants the data in Y-M-D H:M[:S] format.
My data is in mmddyy8. format. And I tried to change it to YYMMDD format to export it to redcap. My data only has date no time.
hjjijkkl
Pyrite | Level 9

what is the Language Element for YMD HMS order

andreas_lds
Jade | Level 19

I don't know if a format exits that appends fake-time information to a date. Most likely you will have to convert the date into a sas datetime before exporting it. You could use the function dhms.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 4 replies
  • 1488 views
  • 0 likes
  • 3 in conversation