BookmarkSubscribeRSS Feed
ursula
Pyrite | Level 9

I tried to do a math of the Elapstime, for example: Time_pickup =15:00 and Time_received=15:36, so the Elapstime will be Time_received - Time_pickup.

the result is not showing the time value, like 0:36 instead 2160.

does any one know what is the 'Time Format' is?

thank you.

7 REPLIES 7
AncaTilea
Pyrite | Level 9

Try this:

   format Elapstime time5.;

Good luck.

Anca.

ursula
Pyrite | Level 9

thank you so much, Anca, it's very helpful.

ursula
Pyrite | Level 9

Another problem is, when I got the Elapsed_time fixed, but, when I run it in proc means, it came back as a long number again instead of like 0:35.

Do you know how to fix it?

thanks,

Linlin
Lapis Lazuli | Level 10

data have;

input time;

cards;

2160

2161

2162

2163

;

proc means data=have mean noprint;

var time;

format time time5.;

output out=temp(drop=_:) mean=mean;

run;

proc print data=temp;run;

                                Obs     mean

                                    1      0:36

ursula
Pyrite | Level 9

thank you very much.

do you mind to explain to me what is the "output out=temp(drop=_:) mean= mean" means?

thank you.

Linlin
Lapis Lazuli | Level 10

You are welcome!

"output out="  creates a dataset," (drop=_:)" drop all the variables begin with _. "mean=mean" names the calculated mean mean.

you may understand better by running the modified code below:

data have;

input time;

cards;

2160

2161

2162

3863

;

proc means data=have mean noprint;

var time;

format time time5.;

output out=new_dataset /* temp(drop=_:)*/ mean=aaa /*mean*/;

run;

proc print data=new_dataset;run;

                       Obs    _TYPE_    _FREQ_      aaa

                          1          0              4           0:43

ursula
Pyrite | Level 9

Thank you again, Have a great weekend!

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
  • 7 replies
  • 907 views
  • 9 likes
  • 3 in conversation