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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

data want (drop=in_:);

  set have (rename=GPS_Time=in_time);

   format GPS_Time time10.;

GPS_Time = input(in_time,time10.);

run;

View solution in original post

6 REPLIES 6
data_null__
Jade | Level 19

Read the variable with TIME10. informat.

time = input(xltime,time10.);

iiibbb
Quartz | Level 8

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.

Tom
Super User Tom
Super User

Import it as a temporary dataset and then use a data step to create the permanent dataset with the time variable converted.

iiibbb
Quartz | Level 8

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

art297
Opal | Level 21

data want (drop=in_:);

  set have (rename=GPS_Time=in_time);

   format GPS_Time time10.;

GPS_Time = input(in_time,time10.);

run;

iiibbb
Quartz | Level 8

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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 864 views
  • 0 likes
  • 4 in conversation