Need Help

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Need Help

Manoj Soni

Dear Listers.

 

Hello and Greetings.

 

I need one help regarding help in spss.

 

I have Two variables named; Start Time_Hrs.    and Start Time_Minutes;       Example:     in Start Time_Hrs the value is 11    and    30  is in Start Time_minutes             ; It means Time is   30 minutes past 11       .

 

And the same pattern ;

 

I have Two more variables named. End Time_Hrs.    and End Time_Minutes  ;       Example:    In End Time the value is 12    and    40 is in End Time_minute              ; It means Time is   40 minutes past 12      

 

Start Time_Hrs

Start Time_Minutes

End Time_Hrs

End Time_Minutes

Difference in minutes

11

30

12

40

70( Should be caluculated automatically )?

.

 

Now I have to calculate one variable that should have the difference in minutes  of both time ( End Time-Start Time , it means according to my example, the answer should come in new variable 70 minutes.

 

How can we do this using spss.

 

Thanks in advance.

 

Warm Regards

Manoj

 

Reply | Threaded
Open this post in threaded view
|

Re: Need Help

Maclennan, Graeme S.
Manoj asked:
 
 

I have Two variables named; Start Time_Hrs.    and Start Time_Minutes;       Example:     in Start Time_Hrs the value is 11    and    30  is in Start Time_minutes             ; It means Time is   30 minutes past 11       .

 

And the same pattern ;

 

I have Two more variables named. End Time_Hrs.    and End Time_Minutes  ;       Example:    In End Time the value is 12    and    40 is in End Time_minute              ; It means Time is   40 minutes past 12      

 

Start Time_Hrs

Start Time_Minutes

End Time_Hrs

End Time_Minutes

Difference in minutes

11

30

12

40

70( Should be caluculated automatically )?

.

 

A simple solution is covert it all to minutes and do the subtraction. This will only work with times on the same date and using the 24 hours clock (as I am assuming you are given this example). This avoids using the more sophisticated calculations required if are looking differences that go over different dates, but if you need that write back.  

 

******begin************

 

new file.
data list list
/ Start_Time_Hrs Start_Time_Minutes End_Time_Hrs End_Time_Minutes.
begin data
11 ,  30, 12 , 40
end data.

 

compute Difference_in_minutes = (60*End_Time_Hrs + End_Time_Minutes)  - (60*Start_Time_Hrs + Start_Time_Minutes).
exe.
********* end************

 

HTH

g.

 



The University of Aberdeen is a charity registered in Scotland, No SC013683.
Reply | Threaded
Open this post in threaded view
|

Re: Need Help: "Subtracting time variables"?

David Marso
Administrator
In reply to this post by Manoj Soni
Looks like your question was answered.  May I suggest a more descriptive title for future questions?
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Automatic reply: Need Help: "Subtracting time variables"?

Marhefka, Stephanie

Dr. Marhefka is out of the office until Monday, March 21, and will have limited access to email during that time.

Reply | Threaded
Open this post in threaded view
|

Re: Need Help: "Subtracting time variables"?

Bruce Weaver
Administrator
In reply to this post by David Marso
Yeah...something like "Need Help -- URGENT!!!!!"   (Especially if it is near the end of a university semester.)  ;-)


David Marso wrote
Looks like your question was answered.  May I suggest a more descriptive title for future questions?
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Need Help: "Subtracting time variables"?

David Marso
Administrator
Yeah, something like that will do it... *NOT*.
That one's a perfect recipe for being ignored.   *SCREAMING* in the subject!
It also conveys a "My problem/question is MORE important than anyone else's"
It is URGENT because... I have procrastinated...My boss is in a hurry for it and I DKWTF I am doing so YOU do it for me NOW!!!

The best way to get help is to provide a clear descriptive subject line with a concise, complete explanation of what is desired in the body of the message -Please keep it short and sweet- .  Include a description of the current data arrangement, what you have ALREADY TRIED including error messages/warnings etc.  Any sort of vague indication that you have actually attempted to solve it yourself along with a relevant data mock up will work wonders.  SUPER BONUS for suggesting you have actually browsed through the manual in search for the answer.  Insisting on a point/click pathway rather than a syntax solution will also likely reduce the probability of receiving an answer.  Reliance upon InterneTelepathy is also a doomed strategy.
HTH, David


Bruce Weaver wrote
Yeah...something like "Need Help -- URGENT!!!!!"   (Especially if it is near the end of a university semester.)  ;-)


David Marso wrote
Looks like your question was answered.  May I suggest a more descriptive title for future questions?
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"