I am an R
user and SAS
beginner trying to read a csv file into SAS
. The problem I am facing is with a column called "TIME" which contains time data in the format "hh:mm " for e.g. "12:23 PM". In R
it is as simple as as.POSIXct(df$TIME, format = "%I:%M %p")
and my hour is converted to time values instantly (with time-zone and today's date which can be removed).
This is how I tried to implement this in SAS:
/* firstly `rename` "TIME" to "DAY_HOUR" */
data mid.prac1;
set mid.prac1;
rename time = DAY_HOUR;
run;
/*runs successfully */
/* remove unwanted characters from DAY_HOUR */
data mid.prac2;
set mid.prac1;
DAY_HOUR = compress(DAY_HOUR, 'PMAM');
proc print; run;
/* runs successfully */
/* format hh:mm as time */
data mid.prac3;
set mid.prac2;
informat DAY_HOUR time10.;
run;
**/*Error: ERROR 48-59: The informat $TIME was not found or could not be loaded.*/**
The time
informat
does not exist? I read this documentation on the SAS website: http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000201204.htm and I think I am doing it right. I am new to the whole SAS universe so apologies if I am not following conventions in asking questions and pasting sample data etc.