BookmarkSubscribeRSS Feed
sravanpathu
Calcite | Level 5

Dear ALL,

valuetime
0.000365480:00:32
0.00222220:03:12
0.00050:00:43

In the above table i got value column after so many calculations.

In time column i just applied time format in excel can we do the same in sas.

Used excel format  37:30:55.

Please help me its urgent for me.

Regards,

Sravan

5 REPLIES 5
Florent
Quartz | Level 8

Hi Sravan,

Is this what you want to achieve ?

data want;

     set have;

     format time tod8.;

     time = value * 86400;

run;

Kr,

Florent

Tom
Super User Tom
Super User

SAS stores time as the number of seconds since midnight. Excel is storing it as a fraction of a day.  So to convert your variable VALUE to a variable that you could treat as time in SAS you need to mulitply by 24 hours.

66   data want ;

67     input value time time. ;

68     time2 = value*'24:00:00't ;

69     format time time2 time.;

70     put (_all_) (=);

71   cards;

value=0.00036548 time=0:00:32 time2=0:00:32

value=0.0022222 time=0:03:12 time2=0:03:12

value=0.0005 time=0:00:43 time2=0:00:43

Jagadishkatam
Amethyst | Level 16

Just another way

data want;

    input value time time8.;

    format time time8.;

cards;

0.00036548    0:00:32

0.0022222    0:03:12

0.0005    0:00:43

;

proc print;

run;

Thanks,

Jagadish

Thanks,
Jag
Florent
Quartz | Level 8

I think he wanted to know how to create the 'time' variable from the 'value' variable instead of reading both. Your example is just reading values, there is no calculation.

Regards,

Florent

sravanpathu
Calcite | Level 5

Thank every one i got my answer.

Once again thanks a lot.

Regards,

Shraz'sSmiley Happy

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1339 views
  • 0 likes
  • 4 in conversation