I have a STRING variable for example: 22.10.1990 12:20:31 and I
want convert this
for a DATE format in SPSS using syntax. Do you know a soluction?
Thanks for all responses.
Carlos Renato
Statistician
- Identify the row where your string variable is.
- Under the column "type", click and open a menu
- Check "Date"
- In the selection list, choose dd-mmm-yyyy hh:mm:ss
That should do the job.
Although it does not have exactly the situation you describe, this file
shows how to convert string variables to date variables. It should give
you some good ideas.
www.angelfire.com/wv/bwhomedir/spss/importing_excel_dates.txt
--
Bruce Weaver
bwe...@lakeheadu.ca
www.angelfire.com/wv/bwhomedir
I want to solve this using syntax.
Thanks for response.
Carlos Renato
the.lae...@gmail.com escreveu:
The Bonus Pack modules, if you have SPSS 15 with programmability
installed, include a very general date or date/time pattern language
that can be used to convert almost anything.
Function strtodatetime(value, pattern) takes a string and a pattern and
produces an SPSS date/time variable. In this case, the pattern would
be something like this:
"%d.%m%Y %I:%M%S" if your hours are 12-hour or the %I would be %H if in
24 hour.
In the former case, you could also include %p to indicate am/pm.
You would use this function, which is in the extendedTransforms module
with the trans module to have it iterate over all the cases.
The Bonus Pack will be available on SPSS Developer Central
(www.spss.com/devcentral) at the end of November.
HTH,
Jon Peck
SPSS