homologate the format of the character type variables (string)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

homologate the format of the character type variables (string)

Javier Figueroa
Good morning experts in SPSS

I have a situation that could be very simple but that is complicated depending on the size of the database that is worked, when I refer to size I mean the number of variables that the database has. My case is that I have two databases that I need to unify using the MATCH FILES command, with the numeric type variables I have no problem in the format my problem starts with the variables type string if in a base the variable XX_1 is A20 format and in the other base the variable XX_1 is A19 format, they are taken as different. I would like to know if in SPSS there is a way to standardize the format of the variables, EJ.
FORMAT all STRING A100. I do not know if it's possible,

Any information will be very grateful,

Sincerely,

--
Javier Figueroa
Procesamiento y Análisis de bases de datos
Cel: 5927-4748 / 4970-1940
Casa: 2289-0184

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: homologate the format of the character type variables (string)

Bruce Weaver
Administrator
Hello Javier.  See the solution in this old post:

http://spssx-discussion.1045642.n5.nabble.com/Syntax-to-process-several-sav-files-td5731762.html#a5731766

Of course, you'll want MATCH FILES, not ADD FILES.  But the use of ALTER
TYPE before and after merging files will be the same.  

HTH.



Javier Figueroa wrote

> Good morning experts in SPSS
>
> I have a situation that could be very simple but that is complicated
> depending on the size of the database that is worked, when I refer to size
> I mean the number of variables that the database has. My case is that I
> have two databases that I need to unify using the MATCH FILES command,
> with
> the numeric type variables I have no problem in the format my problem
> starts with the variables type string if in a base the variable XX_1 is
> A20
> format and in the other base the variable XX_1 is A19 format, they are
> taken as different. I would like to know if in SPSS there is a way to
> standardize the format of the variables, EJ.
> FORMAT all STRING A100. I do not know if it's possible,
>
> Any information will be very grateful,
>
> Sincerely,
>
> --
>
> *Javier FigueroaProcesamiento y Análisis de bases de datos*
> *Cel: 5927-4748 / 4970-1940*
>
>
> *Casa: 2289-0184*
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
Reply | Threaded
Open this post in threaded view
|

Re: homologate the format of the character type variables (string)

John F Hall
In reply to this post by Javier Figueroa

In haste as I've just switched SPSS off.  I'm sure you can do it and merging should work if all the XX-! Vars are in the same format.  Check out ALTER TYPE in the manual.

 

John F Hall  MA (Cantab) Dip Ed (Dunelm)

[Retired academic survey researcher]

 

Email:          [hidden email]

Website:     Journeys in Survey Research

Course:       Survey Analysis Workshop (SPSS)

Research:   Subjective Social Indicators (Quality of Life)

 

From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Javier Figueroa
Sent: 22 March 2018 19:19
To: [hidden email]
Subject: homologate the format of the character type variables (string)

 

Good morning experts in SPSS

 

I have a situation that could be very simple but that is complicated depending on the size of the database that is worked, when I refer to size I mean the number of variables that the database has. My case is that I have two databases that I need to unify using the MATCH FILES command, with the numeric type variables I have no problem in the format my problem starts with the variables type string if in a base the variable XX_1 is A20 format and in the other base the variable XX_1 is A19 format, they are taken as different. I would like to know if in SPSS there is a way to standardize the format of the variables, EJ.

FORMAT all STRING A100. I do not know if it's possible,

 

Any information will be very grateful,

 

Sincerely,

 

--

Javier Figueroa
Procesamiento y Análisis de bases de datos

Cel: 5927-4748 / 4970-1940

Casa: 2289-0184

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: homologate the format of the character type variables (string)

Jon Peck
In reply to this post by Javier Figueroa
With many variables (or many files), an automated way of synchronizing the string widths can be a big time saver and error avoider.  The STATS ADJUST WIDTHS extension command is designed to do this.

From its help...
Adjust the widths of string variables across datasets to be the same for convenience in merging and similar operations

STATS ADJUST WIDTHS VARIABLES=variables*
WIDTH=MAX** or MIN or FIRST
MAXWIDTH=integer
DSNAMEROOT=rootname
EXACTWIDTH=integer

/FILES list of file names and wilcards and dataset names*

/OUTFILE RESAVE=NO** or YES
SUFFIX=“string
DIRECTORY=“directory
OVERWRITE=NO** or YES
CLOSE=NO** or YES

VARIABLES=ALL can be used to select all string variables.

Press F1 on an instance of the command in the Syntax Editor to see the full syntax description.

You can install this from the Utilities or Extensions menu if it isn't already present.

On Thu, Mar 22, 2018 at 12:19 PM, Javier Figueroa <[hidden email]> wrote:
Good morning experts in SPSS

I have a situation that could be very simple but that is complicated depending on the size of the database that is worked, when I refer to size I mean the number of variables that the database has. My case is that I have two databases that I need to unify using the MATCH FILES command, with the numeric type variables I have no problem in the format my problem starts with the variables type string if in a base the variable XX_1 is A20 format and in the other base the variable XX_1 is A19 format, they are taken as different. I would like to know if in SPSS there is a way to standardize the format of the variables, EJ.
FORMAT all STRING A100. I do not know if it's possible,

Any information will be very grateful,

Sincerely,

--
Javier Figueroa
Procesamiento y Análisis de bases de datos
Cel: 5927-4748 / 4970-1940
Casa: 2289-0184

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD



--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: homologate the format of the character type variables (string)

Javier Figueroa
oh, I'm wrong, you're right Bruce Weaver, thanks for the correction, it's the command ADD FILES was useful with ALTER TYPE ALL (A = A255).

Thanks Jon, I'll read a little more about that STATS ADJUST WIDTHS VARIABLES = variables * command, which really facilitates this process, which is simple but very cumbersome when there are too many variables.


It's funny, that change was made by hand, variable by variable, thousand thanks.


Thanks to the community for your prompt response,

Sincerely,

2018-03-22 12:56 GMT-06:00 Jon Peck <[hidden email]>:
With many variables (or many files), an automated way of synchronizing the string widths can be a big time saver and error avoider.  The STATS ADJUST WIDTHS extension command is designed to do this.

From its help...
Adjust the widths of string variables across datasets to be the same for convenience in merging and similar operations

STATS ADJUST WIDTHS VARIABLES=variables*
WIDTH=MAX** or MIN or FIRST
MAXWIDTH=integer
DSNAMEROOT=rootname
EXACTWIDTH=integer

/FILES list of file names and wilcards and dataset names*

/OUTFILE RESAVE=NO** or YES
SUFFIX=“string
DIRECTORY=“directory
OVERWRITE=NO** or YES
CLOSE=NO** or YES

VARIABLES=ALL can be used to select all string variables.

Press F1 on an instance of the command in the Syntax Editor to see the full syntax description.

You can install this from the Utilities or Extensions menu if it isn't already present.

On Thu, Mar 22, 2018 at 12:19 PM, Javier Figueroa <[hidden email]> wrote:
Good morning experts in SPSS

I have a situation that could be very simple but that is complicated depending on the size of the database that is worked, when I refer to size I mean the number of variables that the database has. My case is that I have two databases that I need to unify using the MATCH FILES command, with the numeric type variables I have no problem in the format my problem starts with the variables type string if in a base the variable XX_1 is A20 format and in the other base the variable XX_1 is A19 format, they are taken as different. I would like to know if in SPSS there is a way to standardize the format of the variables, EJ.
FORMAT all STRING A100. I do not know if it's possible,

Any information will be very grateful,

Sincerely,

--
Javier Figueroa
Procesamiento y Análisis de bases de datos
Cel: 5927-4748 / 4970-1940
Casa: 2289-0184

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD



--
Jon K Peck
[hidden email]




--
Javier Figueroa
Procesamiento y Análisis de bases de datos
Cel: 5927-4748 / 4970-1940
Casa: 2289-0184

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: homologate the format of the character type variables (string)

Rick Oliver
In reply to this post by Javier Figueroa
Theoretically, you can use STAR JOIN to merge strings of different defined lengths, but if the number of string variables with this problem is small, ALTER TYPE prior to MATCH FILES is probably a better solution.

On Thu, Mar 22, 2018 at 1:19 PM, Javier Figueroa <[hidden email]> wrote:
Good morning experts in SPSS

I have a situation that could be very simple but that is complicated depending on the size of the database that is worked, when I refer to size I mean the number of variables that the database has. My case is that I have two databases that I need to unify using the MATCH FILES command, with the numeric type variables I have no problem in the format my problem starts with the variables type string if in a base the variable XX_1 is A20 format and in the other base the variable XX_1 is A19 format, they are taken as different. I would like to know if in SPSS there is a way to standardize the format of the variables, EJ.
FORMAT all STRING A100. I do not know if it's possible,

Any information will be very grateful,

Sincerely,

--
Javier Figueroa
Procesamiento y Análisis de bases de datos
Cel: 5927-4748 / 4970-1940
Casa: 2289-0184

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD