I am trying to import a GIS field that contains time data. SAS is
importing it from Excel as a character string, but I need to convert it to a time
string. I can 't seem to figure out how.
Examples of the field is
10:12:56am
11:23:23am
12:43:23pm
03:45:21pm
05:23:53pm
I am a little befuddled.
data want (drop=in_:);
set have (rename=GPS_Time=in_time);
format GPS_Time time10.;
GPS_Time = input(in_time,time10.);
run;
Read the variable with TIME10. informat.
time = input(xltime,time10.);
Explain further...
if I import the data using the import data menu, and create a permanent dataset in a library.
Then I create a temporary dataset and convert the variable using that formula?
It might help to note that Excel doesn't recognize it as a time field either.
Import it as a temporary dataset and then use a data step to create the permanent dataset with the time variable converted.
say the variable's name is GPS_Time.
Could you please give me an example of that syntax?
I tried adding it, but apparently I'm putting it in the wrong place.
Thank you
data want (drop=in_:);
set have (rename=GPS_Time=in_time);
format GPS_Time time10.;
GPS_Time = input(in_time,time10.);
run;
Thank you.
Sometimes I wonder if I'm ever going to understand some of this syntax... but I've always had so much control over my data before moving to SAS and thus, my code has always been clean and simple. This automated stuff is really making me realize how much I don't know.
Thanks
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.