Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6545219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:33:33+00:00 2026-05-25T11:33:33+00:00

I have timestamps in a column which I have imported in SPSS. Example, 7/6/2011

  • 0

I have timestamps in a column which I have imported in SPSS. Example, 7/6/2011 2:21 in a column called ‘Observation’

This is in the string format. Now I also have timezone corrections for these data. So, -60 would mean subtract 60 minutes from this date.

How would I do this in SPSS syntax?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:33:34+00:00Added an answer on May 25, 2026 at 11:33 am

    There are native date formats in SPSS, but unfortunately it does not appear that any cover the example you posted. I would parse the beginning of the string field to get the mm/dd/yyyy and the hh:mm part seperate, convert those into their representative time formats, and then do the time calculations.

    For an example

    data list fixed / observation (A25).
    begin data
    7/6/2011 2:21
    10/11/2011 15:42
    07/06/2011 02:21
    3/15/2011 0:21
    end data.
    
    *getting the data part, assuming the space will always delimit the two parts.
    compute #space = char.index(observation," ").
    string date (A10).
    compute date = char.substr(observation,1,#space-1).
    *getting the time part.
    string time (A5).
    compute time = char.substr(observation,#space+1,5).
    execute.
    
    *now converting them into date formats.
    alter type date (A10 = ADATE10).
    alter type time (A5 = TIME5).
    *you should check these carefully to make sure they were converted correctly.
    *now making one time variable.
    compute date_time = date + time.
    formats date_time (DATETIME17).
    execute.
    
    *now it is just as simple as subtracting the specified value.
    compute date_time_adj = DATESUM(date_time,-60,"minutes").
    execute.
    formats date_time_adj (DATETIME17).
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySql table which has a timestamp column. The table also has
I have two data frames with two columns each. The first column is timestamps
Simply put, I have a table with, among other things, a column for timestamps.
I have a sqlite (v3) table with this column definition: timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
I have 3 tables with a column in each which relates to one ID
I have an order table in MySQL database, having a field/column which stores the
I have a table with this column: last_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON
I have a Users model which needs an :email column (I forgot to add
I have a view like this: CREATE VIEW MyView AS SELECT Column FROM Table
I need a select from table which does not have column that tells when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.