| Date: | Fri, 16 Dec 2005 16:42:10 -0000 |
| Reply-To: | Ian Maddrell <Ian.Maddrell@pcwb.com> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
| From: | Ian Maddrell <Ian.Maddrell@pcwb.com> |
| Subject: | Re: formats for importing |
|
| Content-Type: | text/plain; charset="iso-8859-1" |
Hello Adrian
Have you tried this?
GET DATA /TYPE = TXT
/FILE = 'R:\prov.txt'
/FIXCASE = 1
/ARRANGEMENT = FIXED
/FIRSTCASE = 1
/IMPORTCASE = ALL
/VARIABLES =
/1 ID 0-9 A10
Var1 2615-2621 COMMA5.8
Var2 2622-2628 COMMA5.8.
CACHE.
EXECUTE.
You can adjust the numbers following the comma statement to the desired length.
Untested but certainly solves the truncation problem when dealing with monetary values over £9999.
Thanks
Ian Maddrell PgDipM
Campaign Planner
ext. 113647
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
Adrian Musters
Sent: 16 December 2005 16:28
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: formats for importing
Hi everyone,
I have data in a text file which has over 3000 characters per line in a
fixed-width format. I need to import 3 variables in a very specific
way. The ID variable is a string (this works fine) and is imported from
characters 0-9. The variables I'm having trouble with are numeric
variables called Var1 and Var2. In the text file Var1 is found in
characters 2615-2621. If I were to import it using F7.0 I can see that
they are always 4 digits or less (i.e. less than or equal to 9999).
What I would like to do is import the numbers with the decimal place
before the last two digits. I tried to import them using F5.2, but this
truncates everything right of the decimal. For example when I import
566 with F5.2 I was hoping that it would result in 5.66, but instead I
get 5.00. Does anyone know of a way to import these variables so that
I would see 5.66 or 99.99 without having to import them and then divide
by 100?
Here is the syntax I'm using...
GET DATA /TYPE = TXT
/FILE = 'R:\prov.txt'
/FIXCASE = 1
/ARRANGEMENT = FIXED
/FIRSTCASE = 1
/IMPORTCASE = ALL
/VARIABLES =
/1 ID 0-9 A10
Var1 2615-2621 F5.2
Var2 2622-2628 F5.2.
CACHE.
EXECUTE.
Thanks in advance,
Adrian
______________________________________________________________
This message has been scanned for all viruses by BTnet VirusScreen.
The service is delivered in partnership with MessageLabs.
This service does not scan any password protected or encrypted
attachments.
If you are interested in finding out more about the service,
please visit our website at
http://www.btignite.com/internetservices/btnet/products_virusscreen.htm
==============================================================
This e-mail has been sent from a PC belonging to DSG Retail Limited or another company in the Dixons Group, registered office Maylands Avenue, Hemel Hempstead, Hertfordshire HP2 7TG. Its contents are confidential to the sender and the intended recipient.
If you receive it in error, please tell us by return and then delete it from your system; you may not rely on its contents nor copy/disclose it to anyone.
Opinions, conclusions and statements of intent in this e-mail are those of the sender and will not bind a Dixons Group company unless confirmed by an authorised representative independently of this message. We do not accept responsibility for viruses; you must scan for these.
Please note that e-mails sent to and from the Dixons Group are routinely monitored for record keeping, quality control and training purposes, to ensure regulatory compliance and to prevent viruses and unauthorised use of our computer systems.
|