f



SAS time problem and formula problem

Hi All,

I have two problems, and I really hope you can help me.

The first problem is that I want to take the Log of a time variable (format
is hhmm6.), but the answer returned is wrong. I have used the following
code:

/* p is a time variable with format hh:mm5.*/

data 'C:\Vijay Data\Research project\Project\Data\craw4';
     set craw3_1;
     ln_aa=log(p);
     format ln_aa hhmm5.;
run;

For example if p=45:00 (hh:mm) then ln_aa equals 00:00 (hh:mm) but I want
it to read 3.807.  The answer I want is in units of hours, how can I get
this answer?

The second problem is that I want manipulate data in a way that will allow
me to use a formula. Let me clarify this by using an example, if I had two
variables (x and y) and I want a data step to calculate the following
equation:

(Embedded image moved to file: pic09961.pcx)

how would I do it?

Any help would be grateful appreciated.

Regards

Vijay Reddi
Senior Quality Assurance Statistician
Tel:+44 (0)1223 423232 (235)
Fax:+44 (0)1223 426926

_________________________________________________________________________________
The information contained in this e-mail is confidential and may be privileged.
It is intended for the addressee only.  If you are not the intended recipient,
please delete this e-mail immediately.  The contents of this e-mail must not be
disclosed or copied without the consent of the sender.

The statements and opinions expressed in this message are those of the author
and do not necessarily reflect those of the Company.  The Company does not take
any responsibility for the views of the author.

No contracts may be concluded on behalf of the Company or any of it's subsidiaries
or divisions by means of email communications.

Although we have taken steps to ensure that this email and attachments are free
from any virus, we cannot accept any responsibility for viruses so email
attachments should be virus-checked on receipt.
0
11/3/2003 11:51:14 AM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

2 Replies
874 Views

Similar Articles

[PageSpeed] 53

Hello Vijay

I can only answer your first question since the formula was not readable
for me. (SAS-L removes attachments, incl the picture showing your formula)

Consider this data step ...

data in;
  format hr hhmm5.;

  hr = '45:00't; /* <-- 45 hours and 0 minutes -- */

  hrn = hr/(60*60); /* <-- number of decimal hours from
                           0 minutes. Using the hour()
                           function will return 21 which
                           is incorrect -- */

  loghrn = log(hrn);  /* <-- gives you the 3.807 -- */
run;

I think the issue is the value of hr. You see 45:00 which is the
representation of the SAS hhmm5. format. The SAS stored value is a numeric
162000, the number of seconds since the time 0 or 00:00. When you use the
formula log(hr) you are doing log(162000) and not log(45) as you may want.

HTH

Magnus


On Mon, 3 Nov 2003 11:51:14 +0000, Vijay Reddi <Vijay.Reddi@SSL-
INTERNATIONAL.COM> wrote:

>Hi All,
>
>I have two problems, and I really hope you can help me.
>
>The first problem is that I want to take the Log of a time variable (format
>is hhmm6.), but the answer returned is wrong. I have used the following
>code:
>
>/* p is a time variable with format hh:mm5.*/
>
>data 'C:\Vijay Data\Research project\Project\Data\craw4';
>     set craw3_1;
>     ln_aa=log(p);
>     format ln_aa hhmm5.;
>run;
>
>For example if p=45:00 (hh:mm) then ln_aa equals 00:00 (hh:mm) but I want
>it to read 3.807.  The answer I want is in units of hours, how can I get
>this answer?
>
>The second problem is that I want manipulate data in a way that will allow
>me to use a formula. Let me clarify this by using an example, if I had two
>variables (x and y) and I want a data step to calculate the following
>equation:
>
>(Embedded image moved to file: pic09961.pcx)
>
>how would I do it?
>
>Any help would be grateful appreciated.
>
>Regards
>
>Vijay Reddi
>Senior Quality Assurance Statistician
>Tel:+44 (0)1223 423232 (235)
>Fax:+44 (0)1223 426926
>
>___________________________________________________________________________
______
>The information contained in this e-mail is confidential and may be
privileged.
>It is intended for the addressee only.  If you are not the intended
recipient,
>please delete this e-mail immediately.  The contents of this e-mail must
not be
>disclosed or copied without the consent of the sender.
>
>The statements and opinions expressed in this message are those of the
author
>and do not necessarily reflect those of the Company.  The Company does not
take
>any responsibility for the views of the author.
>
>No contracts may be concluded on behalf of the Company or any of it's
subsidiaries
>or divisions by means of email communications.
>
>Although we have taken steps to ensure that this email and attachments are
free
>from any virus, we cannot accept any responsibility for viruses so email
>attachments should be virus-checked on receipt.
0
11/3/2003 1:09:04 PM
Please re-post your second question and present the formula in-line, as
part of the message. SAS-L does not allow attachments.

Also make it a separate posting, with its own subject. When a person has
two or more unrelated questions, there is no reason to bundle them in one
posting. It's not as if one has to pay for postage. Making a separate
posting for each question, with appropriate subjects, makes it much easier
to carry on and follow the discussions.

On Mon, 3 Nov 2003 11:51:14 +0000, Vijay Reddi <Vijay.Reddi@SSL-
INTERNATIONAL.COM> wrote:

>Hi All,
>
>I have two problems, and I really hope you can help me.
>
>The first problem is that I want to take the Log of a time variable (format
>is hhmm6.), but the answer returned is wrong. I have used the following
>code:
>
>/* p is a time variable with format hh:mm5.*/
>
>data 'C:\Vijay Data\Research project\Project\Data\craw4';
>     set craw3_1;
>     ln_aa=log(p);
>     format ln_aa hhmm5.;
>run;
>
>For example if p=45:00 (hh:mm) then ln_aa equals 00:00 (hh:mm) but I want
>it to read 3.807.  The answer I want is in units of hours, how can I get
>this answer?
>
>The second problem is that I want manipulate data in a way that will allow
>me to use a formula. Let me clarify this by using an example, if I had two
>variables (x and y) and I want a data step to calculate the following
>equation:
>
>(Embedded image moved to file: pic09961.pcx)
>
>how would I do it?
>
>Any help would be grateful appreciated.
>
>Regards
>
>Vijay Reddi
>Senior Quality Assurance Statistician
>Tel:+44 (0)1223 423232 (235)
>Fax:+44 (0)1223 426926
>
>___________________________________________________________________________
______
>The information contained in this e-mail is confidential and may be
privileged.
>It is intended for the addressee only.  If you are not the intended
recipient,
>please delete this e-mail immediately.  The contents of this e-mail must
not be
>disclosed or copied without the consent of the sender.
>
>The statements and opinions expressed in this message are those of the
author
>and do not necessarily reflect those of the Company.  The Company does not
take
>any responsibility for the views of the author.
>
>No contracts may be concluded on behalf of the Company or any of it's
subsidiaries
>or divisions by means of email communications.
>
>Although we have taken steps to ensure that this email and attachments are
free
>from any virus, we cannot accept any responsibility for viruses so email
>attachments should be virus-checked on receipt.
0
11/3/2003 3:27:07 PM
Reply:

Similar Artilces:

Re: SAS time problem and formula problem
Hello Vijay I can only answer your first question since the formula was not readable for me. (SAS-L removes attachments, incl the picture showing your formula) Consider this data step ... data in; format hr hhmm5.; hr = '45:00't; /* <-- 45 hours and 0 minutes -- */ hrn = hr/(60*60); /* <-- number of decimal hours from 0 minutes. Using the hour() function will return 21 which is incorrect -- */ loghrn = log(hrn); /* <-- gives you the 3.807 -- */ run; I think the issue is the value o...

Re: SAS time problem and formula problem #2
Please re-post your second question and present the formula in-line, as part of the message. SAS-L does not allow attachments. Also make it a separate posting, with its own subject. When a person has two or more unrelated questions, there is no reason to bundle them in one posting. It's not as if one has to pay for postage. Making a separate posting for each question, with appropriate subjects, makes it much easier to carry on and follow the discussions. On Mon, 3 Nov 2003 11:51:14 +0000, Vijay Reddi <Vijay.Reddi@SSL- INTERNATIONAL.COM> wrote: >Hi All, > >I have two probl...

SAS/Warehouse Administrator Problem?? or SAS/ACCESS problem??
hello, I've built a process in SAS/Warehouse Administrator, where i'm trying to extract distinct cities from the 3 tables(source schema) in Oracle into a new table (target schema) called CITY and again into UniqueCity (target schema) bcos of some redundancy. The process looks like this. Unique City | | mapping | | CITY ...

Re: SAS/Warehouse Administrator Problem?? or SAS/ACCESS problem??
I'm pretty sure that behind the scenes SAS/Warehouse Administrator is generating and running SQL code. If you can expose that code and post it here it might help. On Sun, 23 Apr 2006 21:53:41 -0700, saivs28@GMAIL.COM wrote: >hello, > >I've built a process in SAS/Warehouse Administrator, where i'm trying >to extract distinct cities from the 3 tables(source schema) in Oracle >into a new table (target schema) called CITY and again into UniqueCity >(target schema) bcos of some redundancy. The process looks like this. > > Unique ...

SAS/Warehouse Administrator Problem?? or SAS/ACCESS problem?? #2
hello, I've built a process in SAS/Warehouse Administrator, where i'm trying to extract distinct cities from the 3 tables(source schema) in Oracle into a new table (target schema) called CITY and again into UniqueCity (target schema) bcos of some redundancy. The process looks like this. Unique City | | mapping | | CITY ...

Re: SAS/Warehouse Administrator Problem?? or SAS/ACCESS problem?? #2
What's the question? I know it you presented it earlier, but you can't expect people to find the pieces of a problem and put them together. Look at the various intermediate results and find the point where they first diverge from what is expected. Then look at the code which generates that particular result. De-macroize that code and prepare some test data so that anybody can run it easily. Then present that isolated version of the problem (if the answer has not already emerged during this process). On Mon, 24 Apr 2006 11:19:35 -0700, saivs28@GMAIL.COM wrote: >The following code ...

problems problems problems
(The short(?) summary) I've got an Access MDB file and a DAO connect with it.. Problem 1 of 2 The below gives me a runtime error 91 Object variable or With block variable not set. I've got the db stuff after the form.show (to make sure all the objects on the form are loaded before attempting to utilize/manipulate them) But it doesn't like it when I use the data object in the form load anyway for some reason.. pffft. Private Sub Form_Load() frmTest1Project.Show datGallery.Recordset.MoveLast datGallery.Recordset.MoveFirst Call LockTextBoxes(frmTest...

sas date time problem
Hi, I have a question of data in which we are importing the data with proc imports.Now in one of the variables i have is 2005-03-09T01:54:25 which gets truncated to 2005-03-09.Can anybody help on this since i want to use proc import for importing the dataset with time formatted in the above format. can it be done such that all the variables are changed to character format without using the names of variables. this is the sample data tab separated data STUDYID USUBJID DOMAIN BWSEQ BWGRPID BWTESTCD BWTEST BWORRES BWORRESU BWSTRESC BWSTRESN BWSTRESU BWBLFL BWSTDTC BWENDTC BWSTAT BWREASND D...

Re: SAS formula problem
Hi Reddy, It depends how your data are organized. If all your x and y values (1..n) are within a single observation as repeated measures, you might want to obtain a z-value per observation. If your different x and y values are stored in different records, you may want a single z-value for the whole data file. I think your pseudo-code may be rewritten, without changing it, as: z=[sum i=1 to n](x(subscript: i)/y(subscript: i) + x(subscript: i)) In the first case you would have to work with arrays (*untested, just scratch*): %LET N = .....; %* Whatever N you have; DATA New (DRO...

problem when installing SAS. windows x64 does not support SAS?
Hi everyone I am trying to install SAS on a Vista machine. The setup wizard says that Windows x64 does not support the SAS version I am trying to install. What can I do? I greatly appreciate your help. ...

SAS Installation problem
All, This is a problem I have not come across before. A friend of mine is installing SAS on his laptop. The installation proceeds smoothly without errors, but the moment he runs SAS and tries to work in it, the SAS window is closed and SAS.EXE is renamed to SAS.EXE.BAK in the "Program Files" directly. Is it a problem of the Anti-Virus (McAfee Small Business) or a virus? Thanks in advance. Anindya On Aug 19, 8:12=A0am, anindya.lugb...@GMAIL.COM (Anindya Mozumdar) wrote: > All, > =A0 =A0 =A0This is a problem I have not come across before. A friend of m= ine > is install...

Problems problems....
I've got Fujitsu MAN3184MP and Adaptec 29160 scsi card. Sometimes i have this message "A disk read error occured" , sometimes even bios does not recognize it, sometimes it does but the boot sequence does not start it seems that motherboard bios has problems with it ( so it seems to me, i could be wrong about that assumption) . Then i reset and it all works perfectly. I've noticed a speed degradation in Win XP lately. I'm angry :)) I have LVD/SE terminator, and i think 68pin cable ( not sure about that ). Hope i gave you enough info to try and help. Thanx! -- -...

Transfering datasets to Unix /SAS from PC/SAS
Thanks for all your help. I tried using FTP to tranfer datasets from unix to PC. But when I am trying to open the datasets in PC after being transferred I am getting this following message "Invalid header on file. File can not be opened." I tried using "proc download data=unix.dataset out=pc.dataset; run;" I never used SAS/Connect before and I do not have any manual handy for it. So I do not know how it get connected. When I run the above code on unix the log gives me an warning : "PROC DOWNLOAD MUST BE INVOKED WITH THE RSUBMIT COM...

Re: problem when installing SAS. windows x64 does not support SAS?
2 things you can do: 1) switch to 32-bit vista (business / ultimate) 2) or wait for a new version of SAS supporting 64-bit windows On Wed, May 14, 2008 at 10:54 AM, <elodie.gillain@gmail.com> wrote: > Hi everyone > > I am trying to install SAS on a Vista machine. > > The setup wizard says that Windows x64 does not support the SAS > version I am trying to install. > > What can I do? > > I greatly appreciate your help. > -- =============================== WenSui Liu ChoicePoint Precision Marketing Phone: 678-893-9457 Email : wensui.liu@choicepoint.com ...

Web resources about - SAS time problem and formula problem - comp.soft-sys.sas

Problem novel - Wikipedia, the free encyclopedia
Working class, or proletarian novels are often also social problem novels . This was in many ways a reaction to rapid industrialization , and ...

GST increase does not tackle the fundamental problem
Victorian Treasurer Tim Pallas has a point. If we are going to &quot;reform&quot; the tax system let's be very clear about what we are trying ...

"The Yale Problem"
... nice woman who was trying to help them, and reducing her to tears. As we’ve seen more and more of this, I’ve begun calling it, “the Yale problem,” ...

January 2016: New Year, Old Problems Edition
... Drop in Nissan Leaf, Toyota Prius demand more than offset gains from Tesla, Chevy Volt Continue reading January 2016: New Year, Old Problems ...

Will the Galaxy S7 have a ‘chipgate’ problem of its own?
Soon after the iPhone 6s became available to buyers last September, some users starting probing the two chip models powering iPhone 6s models. ...

Weekend Reading: Cosma Shalizi (2012): In Soviet Union, Optimization Problem Solves You
In Soviet Union, Optimization Problem Solves You: Attention conservation notice: Over 7800 words about optimal planning for a socialist economy ...

Theranos is hiring a writer who can 'solve problems through the power of excellent storytelling'
... The embattled company recently posted a job listing stating that it was looking for someone who will "innovate and conceptually solve problems ...

Air bag problem: Automakers to recall 5M vehicles
Continental Automotive Systems says moisture can get inside its air bag control computers, causing power supplies to corrode and fail

Cash is king, and that's a big problem
Financial advisor Mitch Goldberg sees a big problem: too much cash, and too few good bets in the stock market.

Continental recalls 5 million vehicles for a different kind of airbag problem
This recall, which is completely separate from Takata's recall, involves a faulty control unit.

Resources last updated: 2/6/2016 9:51:23 AM