Help using Base SAS procedures

Can we do the same in SAS

Reply
Contributor
Posts: 26

Can we do the same in SAS

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

Frequent Contributor
Posts: 127

Re: Can we do the same in SAS

Posted in reply to sravanpathu

Hi Sravan,

Is this what you want to achieve ?

data want;

     set have;

     format time tod8.;

     time = value * 86400;

run;

Kr,

Florent

Super User
Super User
Posts: 7,076

Re: Can we do the same in SAS

Posted in reply to sravanpathu

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

Trusted Advisor
Posts: 1,137

Re: Can we do the same in SAS

Posted in reply to sravanpathu

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
Frequent Contributor
Posts: 127

Re: Can we do the same in SAS

Posted in reply to Jagadishkatam

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

Contributor
Posts: 26

Re: Can we do the same in SAS

Posted in reply to sravanpathu

Thank every one i got my answer.

Once again thanks a lot.

Regards,

Shraz'sSmiley Happy

Ask a Question
Discussion stats
  • 5 replies
  • 234 views
  • 0 likes
  • 4 in conversation