I've searched up this a lot, but nothing worked for me. It's to my understanding that after I get the INTCK minute output, it's a character data type. So, I've tried converting the output by doing input(output, best.) and input(output, 5.) in the SAS data step as well as in proc sql but neither works. Time is in the format of 24hr. data want;
length query_text $300 time_diff $20;
set temp;
query_text = "blah blah";
time_diff = intck('minute', input(time1, time.), input(time2, time.));
*time_diff = input(temp, 8.); //this doesn't work
keep query_text Subject time_diff;
run;
proc sql;
CREATE TABLE temp2 AS
SELECT query_text, Subject, time_diff /* I've tried input(time_diff, best.) and input(time_diff, 5.) but neither worked */
FROM want
WHERE time_diff > 15 /*Error: Expression using IN has components that are of different data types */
;
quit; Expected output: ╔════════════╦═════════╦═══════════╗ ║ query_text ║ Subject ║ time_diff ║ ╠════════════╬═════════╬═══════════╣ ║ blah ║ 001 ║ 16 ║ ║ blah ║ 002 ║ 1500 ║ ╚════════════╩═════════╩═══════════╝ It's kind of weird. If I have the WHERE statement be: CREATE TABLE temp2 AS
SELECT query_text, Subject, time_diff
FROM want
WHERE time_diff > 15 or time_diff < -15
; It would print out everything, including when time_diff is 15 (same print output as when print "want") and no errors. Any help/advice would be much appreciated, thanks! Edit (after accepting solution): Thanks to some of the replies, I realized that I am indeed assigning the time/number to a character variable. So, I just initialized the "query_text" variable in the data step as length query_text 300 Alright, thanks everyone!
... View more