Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Reading an excel file in SPSS

I have an excel file that has a variable called date of birth (DOB) that is in the following form Jun-58 to represent June 1958. The file has 11,000 cases which creates a myriad of DOB options. I have imported the data file into SPSS, a statistical package for the social sciences. SPSS does not have a data format option to recognize the DOB format produced in the excel file since it is alphnumeric with a dash. Is there an "easy" way to recompute the DOB into a numeric variable in excel, given the format that it is currently in?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Reading an excel file in SPSS

Insert a column next to the DOB column

assume the first cell with DOB is F2, in G2 (the new column) put in the
formula

=DateValue("1-" & trim(F2))
then drag fill down the column (or select G2 and double click on the little
black square on the lower right corner of the highlight.

Now select column G and do Edit=Copy, then immediately Edit=PasteSpecial
and select Values

format the column with a date format. If all the cells resolve OK, then you
can delete column F.

--
Regards,
Tom Ogilvy



"Gary" wrote in message
...
I have an excel file that has a variable called date of birth (DOB) that

is in the following form Jun-58 to represent June 1958. The file has 11,000
cases which creates a myriad of DOB options. I have imported the data file
into SPSS, a statistical package for the social sciences. SPSS does not
have a data format option to recognize the DOB format produced in the excel
file since it is alphnumeric with a dash. Is there an "easy" way to
recompute the DOB into a numeric variable in excel, given the format that it
is currently in?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Reading an excel file in SPSS

Use the Format function:

Format( MyDate,"mm/yyyy") will return 06/1958
if MyDate is a string use Format( CvDate(MyDate),"mm/yyyy")
----- Gary wrote: ----

I have an excel file that has a variable called date of birth (DOB) that is in the following form Jun-58 to represent June 1958. The file has 11,000 cases which creates a myriad of DOB options. I have imported the data file into SPSS, a statistical package for the social sciences. SPSS does not have a data format option to recognize the DOB format produced in the excel file since it is alphnumeric with a dash. Is there an "easy" way to recompute the DOB into a numeric variable in excel, given the format that it is currently in?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Reading an excel file in SPSS

There is no CvDate function. The conversion function is CDate

Also, one reason not to use your approach is inconsistent results:

mydate = "Jun-15"
? Format( MyDate,"mm/yyyy")
06/2004

If the year can be interpreted as a day, it will be. This may not be a
problem for this particular data file - but then again, it may be.

--
Regards,
Tom Ogilvy


"chris" wrote in message
...
Use the Format function:

Format( MyDate,"mm/yyyy") will return 06/1958
if MyDate is a string use Format( CvDate(MyDate),"mm/yyyy")
----- Gary wrote: -----

I have an excel file that has a variable called date of birth (DOB)

that is in the following form Jun-58 to represent June 1958. The file has
11,000 cases which creates a myriad of DOB options. I have imported the
data file into SPSS, a statistical package for the social sciences. SPSS
does not have a data format option to recognize the DOB format produced in
the excel file since it is alphnumeric with a dash. Is there an "easy" way
to recompute the DOB into a numeric variable in excel, given the format that
it is currently in?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Reading an excel file in SPSS

There is no CvDate function. The conversion function is CDate
I stand corrected on the CvDate function although it is only offered for
compatibility with older verisions of visual basic.

But it gives the same bad results:

? cvDate("Jun-15")
6/15/04


--
Regards,
Tom Ogilvy



"Tom Ogilvy" wrote in message
...
There is no CvDate function. The conversion function is CDate

Also, one reason not to use your approach is inconsistent results:

mydate = "Jun-15"
? Format( MyDate,"mm/yyyy")
06/2004

If the year can be interpreted as a day, it will be. This may not be a
problem for this particular data file - but then again, it may be.

--
Regards,
Tom Ogilvy


"chris" wrote in message
...
Use the Format function:

Format( MyDate,"mm/yyyy") will return 06/1958
if MyDate is a string use Format( CvDate(MyDate),"mm/yyyy")
----- Gary wrote: -----

I have an excel file that has a variable called date of birth (DOB)

that is in the following form Jun-58 to represent June 1958. The file has
11,000 cases which creates a myriad of DOB options. I have imported the
data file into SPSS, a statistical package for the social sciences. SPSS
does not have a data format option to recognize the DOB format produced in
the excel file since it is alphnumeric with a dash. Is there an "easy"

way
to recompute the DOB into a numeric variable in excel, given the format

that
it is currently in?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA macro for reading text file into Excel Javed Khan Excel Discussion (Misc queries) 0 October 14th 09 06:29 PM
SPSS DATA FILE Tara Excel Worksheet Functions 1 March 13th 08 11:11 PM
spss to excel buggy Excel Discussion (Misc queries) 1 February 24th 06 02:52 AM
2003 Excel isn't reading the book.xlt file on startup. rlweaver007 Excel Discussion (Misc queries) 1 March 15th 05 09:26 AM
Reading an Excel file after upload Quan[_2_] Excel Programming 0 November 6th 03 12:12 AM


All times are GMT +1. The time now is 03:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"