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-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
  • 5 replies
  • 935 views
  • 0 likes
  • 4 in conversation