=========================================================================
Date: Fri, 28 Jul 2006 10:34:15 -0300
Reply-To: Hector Maletta <hmaletta@fibertel.com.ar>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Hector Maletta <hmaletta@fibertel.com.ar>
Subject: Re: Variable length to maximum
In-Reply-To: <4131915968A0FE4CB324EB6D883F5F1245F5D9@exbn01.DPEB.DE>
Content-Type: text/plain; charset="iso-8859-1"
Manmit:
This message deals first with the change in formats, but then jumps to the
real issue: your problem is not with formats but with string variable
LENGTH, quite a different matter.
1. A HOMESPUN SOLUTION FOR FORMATS
I don't have time now to work out a macro for this, and anyway it is perhaps
not worth it for a task to be performed only once, but you can do it in a
homespun way like this. If you have some way to rapidly recognize by name
which variables are strings, you can open the variable information icon in
the toolbar (the small vertical ladder with a question mark), select all
variables (or all string variables) and click PASTE. This will copy the list
of variables into your active syntax window (or a new one if you do not one
already open). Then group the variables in two lists, one for numerical and
one for string variables, and write the keywords at the front and end of
each list, such as:
FORMATS str1 str2 str3 str4 str5 ..... str289 (A255).
FORMATS num1 num2 num3 num4 .........num 876 (F40.0).
2. THE REAL PROBLEM IS NOT FORMATS:
However, from your original question I tend to infer our problem is not with
the FORMAT (the visible number of places) in the variables but the internal
LENGTH of string variables.
To merge files, numerical variables need no adjustment: all are internally
held at the maximum precision allowed by SPSS. But string variables should
have the same LENGTH. The visible FORMAT is not important: the resulting
merged file will show the format of the first file named in the merge list.
The length of string variables is determined at their creation, with the
STRING command. One possible solution for your problem is to create new
string variables with length and copy the old strings into them. Another is
going to the data editor variable view and manually change the WIDTH cell of
all string variables to 255.
Hector
-----Mensaje original-----
De: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] En nombre de Georg
Maubach
Enviado el: Friday, July 28, 2006 10:10 AM
Para: SPSSX-L@LISTSERV.UGA.EDU
Asunto: AW: Re: Variable length to maximum
Hi Manmit,
You could have a look a the web site of Raynald Levesque
http://www.spsstools.net. There you can find a macro called "variable
type.sps". It does what you want and will run on SPSS 11.0+.
Regards
Georg Maubach
Market Analyst
-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] Im Auftrag von
Manmit Shrimali
Gesendet: Freitag, 28. Juli 2006 15:01
An: SPSSX-L@LISTSERV.UGA.EDU
Betreff: Re: Variable length to maximum
Sorry...i do not have v14. also I do not know python.
Anything in syntax?
-----Original Message-----
From: Michael Pearmain [mailto:Michael.Pearmain@tangozebra.com]
Sent: Friday, July 28, 2006 6:24 PM
To: Manmit Shrimali; SPSSX-L@LISTSERV.UGA.EDU
Subject: RE: Re: Variable length to maximum
If your running in V14,
A python script would do this easily by looking at the variable type
MIKE
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
Manmit Shrimali
Sent: 28 July 2006 13:35
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Re: Variable length to maximum
Thanks staffan but the problem is that I need to do for all variables. I
have 550 numeric variables and 39 string variables. Can I use something like
all varnum and all var string etc..
Please help.
-----Original Message-----
From: Staffan Lindberg [mailto:staffan.lindberg@anastat.se]
Sent: Friday, July 28, 2006 5:59 PM
To: Manmit Shrimali; SPSSX-L@LISTSERV.UGA.EDU
Subject: SV: Variable length to maximum
You can do this with the FORMAT statement, i.e.
FORMAT VARNUM (F40.0).
FORMAT VARSTRING (A255).
best
Staffan Lindberg
National Institute of Public Health
Sweden
-----Ursprungligt meddelande-----
Från: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] För Manmit
Shrimali
Skickat: den 28 juli 2006 14:21
Till: SPSSX-L@LISTSERV.UGA.EDU
Ämne: Variable length to maximum
This is rather very simple question. However, after lot of research I still
could not find the answer. Can please anyone provide me syntax for setting
the variable length to maximum i.e numeric to 40 and string to 255.
Right now I have to manually go in width column of variable view and set it
to maximum. I have to set it to maximum as when I have wave 2 data to merge,
the length should be the same.
Thanks in advance.
Manmit
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The service is powered
by MessageLabs. For more information on a proactive anti-virus service
working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email