# IDENTIFY THE QUARTILLES AND CREATE NEW VARIABLES THOSE VALUES

10 messages
Open this post in threaded view
|

## IDENTIFY THE QUARTILLES AND CREATE NEW VARIABLES THOSE VALUES

 Hello spss experts !!!!I hope everyone is well, as far as possible, with this pandemic it affected the whole world a lot and especially the tourism sector that I consider was the most affected by the covid-19 pandemic.I am writing to you because I have a situation in a database that I have not been able to solve and that may be something simple but I have turned it around in my head and I have not been able to do it.I need to create a variable that contains the first quartile (Q1) and the 2nd quartile (MEDIAN) and 3rd quartile (Q3) to then calculate the interqualty range (Q3-Q1)This result will help me to identify the outliersthis is the syntax i am using.* Encoding: UTF-8./* procedimiento crear base de datos PRUEBA.data list list/G_ALOJAMIENTO_D imp_paquete_tur tipoviaj TOTAL.begin data.0.00 0 1 18.93 0 1 167.50 0 2 10.00 0 1  1100.00 0 2 10.00 0 1 10.00 0 2 1150.00 0 1 10.00 0 2 10.00 0 1 10.00 0 1 116.67 0 1 120.00 0 1 115.00 0 2 18.33 0 2 10.00 0 1 18.33 0 2 10.00 0 2 10.00 0 2 112.50 0 2 10.00 0 2 113.33 0 2 17.50 0 1 10.00 0 2 10.00 0 1 10.00 0 1 10.00 0 2 123.51 0 1 10.00 0 1 10.00 0 2 1end data.execute.numeric id(f8.0).compute id=\$casenum.execute.variable level all (scale).COMPUTE x_conteo=1.EXECUTE.SORT CASES BY G_ALOJAMIENTO_D(A).TEMPORARY.SELECT IF G_ALOJAMIENTO_D>0.  FREQUENCIES VARIABLES=G_ALOJAMIENTO_D  /STATISTICS=MEDIAN  /NTILES=4  /PERCENTILES=25.0 50.0 75.0   /ORDER=ANALYSIS.TEMPORARY.SELECT IF G_ALOJAMIENTO_D>0.AGGREGATE  /OUTFILE=* MODE=ADDVARIABLES  /BREAK=TOTAL  /x_conteo_sum=SUM(x_conteo).compute x_Q1=0.compute x_Q2=0.compute x_Q3=0.if x_conteo_sum>0 x_Q1= (x_conteo_sum+1)/4. /* Obtener registro o caso del Q1.if x_conteo_sum>0 x_Q2= (x_conteo_sum+1)/2. /* Obtener registro o caso del Q2.if x_conteo_sum>0 x_Q3= 3*(x_conteo_sum+1)/4. /* Obtener registro o caso del Q3.EXECUTE. * Cuartiles: percentiles 25, 50 y 75, es decir, los valores pordebajo de los cuales se encuentra 25%, 50% y 75% de loscasos respectivamente. * Q1 = 25%(NVAL+1)=3.50. * Q2 = 50%(NVAL+1)=15.00. * Q3= 75%(NVAL+1)=45.50./* AQUI PONER PROCEDIMIENTO PARA CREAR VARIABLES NUEVAS CON LOS VALORES DE LOS CUARTILES.I am very grateful to you in advance and I wish you an excellent start to the week.-- Javier FigueroaProcesamiento y Análisis de bases de datosCel: 5927-4748 / 4970-1940Casa: 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
Open this post in threaded view
|

## Re: IDENTIFY THE QUARTILLES AND CREATE NEW VARIABLES THOSE VALUES

Open this post in threaded view
|

## Re: IDENTIFY THE QUARTILLES AND CREATE NEW VARIABLES THOSE VALUES

 In reply to this post by Javier Figueroa The EXAMINE procedure (Analyze > Descriptive Statistics > Explore)  can give you the IQR,   FREQUENCIES can also give you selected percentiles.  This example uses FREQUENCIES.dataset name main.dataset declare stats.oms select tables /if subtypes='Statistics'/destination outfile=stats format=sav/columns dimnames="Statistics".FREQUENCIES VARIABLES=salary  /FORMAT=NOTABLE  /NTILES=4.omsend.compute const=1.dataset activate stats.compute const=1.dataset activate main.match files /file=* /table=stats/by const/drop Command_ to Missing @50 const.exec.On Tue, Sep 29, 2020 at 11:13 AM Javier Figueroa <[hidden email]> wrote:Hello spss experts !!!!I hope everyone is well, as far as possible, with this pandemic it affected the whole world a lot and especially the tourism sector that I consider was the most affected by the covid-19 pandemic.I am writing to you because I have a situation in a database that I have not been able to solve and that may be something simple but I have turned it around in my head and I have not been able to do it.I need to create a variable that contains the first quartile (Q1) and the 2nd quartile (MEDIAN) and 3rd quartile (Q3) to then calculate the interqualty range (Q3-Q1)This result will help me to identify the outliersthis is the syntax i am using.* Encoding: UTF-8./* procedimiento crear base de datos PRUEBA.data list list/G_ALOJAMIENTO_D imp_paquete_tur tipoviaj TOTAL.begin data.0.00 0 1 18.93 0 1 167.50 0 2 10.00 0 1  1100.00 0 2 10.00 0 1 10.00 0 2 1150.00 0 1 10.00 0 2 10.00 0 1 10.00 0 1 116.67 0 1 120.00 0 1 115.00 0 2 18.33 0 2 10.00 0 1 18.33 0 2 10.00 0 2 10.00 0 2 112.50 0 2 10.00 0 2 113.33 0 2 17.50 0 1 10.00 0 2 10.00 0 1 10.00 0 1 10.00 0 2 123.51 0 1 10.00 0 1 10.00 0 2 1end data.execute.numeric id(f8.0).compute id=\$casenum.execute.variable level all (scale).COMPUTE x_conteo=1.EXECUTE.SORT CASES BY G_ALOJAMIENTO_D(A).TEMPORARY.SELECT IF G_ALOJAMIENTO_D>0.  FREQUENCIES VARIABLES=G_ALOJAMIENTO_D  /STATISTICS=MEDIAN  /NTILES=4  /PERCENTILES=25.0 50.0 75.0   /ORDER=ANALYSIS.TEMPORARY.SELECT IF G_ALOJAMIENTO_D>0.AGGREGATE  /OUTFILE=* MODE=ADDVARIABLES  /BREAK=TOTAL  /x_conteo_sum=SUM(x_conteo).compute x_Q1=0.compute x_Q2=0.compute x_Q3=0.if x_conteo_sum>0 x_Q1= (x_conteo_sum+1)/4. /* Obtener registro o caso del Q1.if x_conteo_sum>0 x_Q2= (x_conteo_sum+1)/2. /* Obtener registro o caso del Q2.if x_conteo_sum>0 x_Q3= 3*(x_conteo_sum+1)/4. /* Obtener registro o caso del Q3.EXECUTE. * Cuartiles: percentiles 25, 50 y 75, es decir, los valores pordebajo de los cuales se encuentra 25%, 50% y 75% de loscasos respectivamente. * Q1 = 25%(NVAL+1)=3.50. * Q2 = 50%(NVAL+1)=15.00. * Q3= 75%(NVAL+1)=45.50./* AQUI PONER PROCEDIMIENTO PARA CREAR VARIABLES NUEVAS CON LOS VALORES DE LOS CUARTILES.I am very grateful to you in advance and I wish you an excellent start to the week.-- Javier FigueroaProcesamiento y Análisis de bases de datosCel: 5927-4748 / 4970-1940Casa: 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
Open this post in threaded view
|

## Re: IDENTIFY THE QUARTILLES AND CREATE NEW VARIABLES THOSE VALUES

### I thank in general this excellent community of expertsI want to apologize if for any reason the mail gave some misunderstanding.At no time did I want someone to do the procedure for me, much less take advantage of their good deed, I understand that everyone is very busy with their activities and this is something extra, and they do it to help. But in my country Guatemala there are not many experts in SPSS and I believed that I could turn to their knowledge to solve my doubt.I understand that my English language is not very fluent, much less perfect, so "Bad Interpretations" happen.I apologize again and I want to express my gratitude for your support because it is not the first time I have received it, since more than once they have saved my life and because of your suggestions I have been able to learn more.I am not even half her knowledge, but here in Guatemala I am above average and when I can solve a problem I do it with great pleasure, here I am an advanced level! LOL.I hope you have an excellent day and that your activities are being carried out successfully.and remember,if I take care of myself, I take care of others!#JuntosSaldremosAdelante#GuatemalaNoSeDetieneSincerely,

El mar., 29 sept. 2020 a las 11:50, Jon Peck (<[hidden email]>) escribió:
The EXAMINE procedure (Analyze > Descriptive Statistics > Explore)  can give you the IQR,   FREQUENCIES can also give you selected percentiles.  This example uses FREQUENCIES.

dataset name main.
dataset declare stats.
oms select tables /if subtypes='Statistics'
/destination outfile=stats format=sav
/columns dimnames="Statistics".
FREQUENCIES VARIABLES=salary
/FORMAT=NOTABLE
/NTILES=4.
omsend.
compute const=1.
dataset activate stats.
compute const=1.
dataset activate main.
match files /file=* /table=stats/by const
/drop Command_ to Missing @50 const.
exec.

On Tue, Sep 29, 2020 at 11:13 AM Javier Figueroa <[hidden email]> wrote:
Hello spss experts !!!!

I hope everyone is well, as far as possible, with this pandemic it affected the whole world a lot and especially the tourism sector that I consider was the most affected by the covid-19 pandemic.

I am writing to you because I have a situation in a database that I have not been able to solve and that may be something simple but I have turned it around in my head and I have not been able to do it.

I need to create a variable that contains the first quartile (Q1) and the 2nd quartile (MEDIAN) and 3rd quartile (Q3) to then calculate the interqualty range (Q3-Q1)

This result will help me to identify the outliers

this is the syntax i am using.

* Encoding: UTF-8.
/* procedimiento crear base de datos PRUEBA.

data list list
/G_ALOJAMIENTO_D imp_paquete_tur tipoviaj TOTAL.
begin data.
0.00 0 1 1
8.93 0 1 1
67.50 0 2 1
0.00 0 1  1
100.00 0 2 1
0.00 0 1 1
0.00 0 2 1
150.00 0 1 1
0.00 0 2 1
0.00 0 1 1
0.00 0 1 1
16.67 0 1 1
20.00 0 1 1
15.00 0 2 1
8.33 0 2 1
0.00 0 1 1
8.33 0 2 1
0.00 0 2 1
0.00 0 2 1
12.50 0 2 1
0.00 0 2 1
13.33 0 2 1
7.50 0 1 1
0.00 0 2 1
0.00 0 1 1
0.00 0 1 1
0.00 0 2 1
23.51 0 1 1
0.00 0 1 1
0.00 0 2 1
end data.
execute.

numeric id(f8.0).
compute id=\$casenum.
execute.
variable level all (scale).

COMPUTE x_conteo=1.
EXECUTE.

SORT CASES BY G_ALOJAMIENTO_D(A).

TEMPORARY.
SELECT IF G_ALOJAMIENTO_D>0.
FREQUENCIES VARIABLES=G_ALOJAMIENTO_D
/STATISTICS=MEDIAN
/NTILES=4
/PERCENTILES=25.0 50.0 75.0
/ORDER=ANALYSIS.

TEMPORARY.
SELECT IF G_ALOJAMIENTO_D>0.
AGGREGATE
/BREAK=TOTAL
/x_conteo_sum=SUM(x_conteo).

compute x_Q1=0.
compute x_Q2=0.
compute x_Q3=0.
if x_conteo_sum>0 x_Q1= (x_conteo_sum+1)/4. /* Obtener registro o caso del Q1.
if x_conteo_sum>0 x_Q2= (x_conteo_sum+1)/2. /* Obtener registro o caso del Q2.
if x_conteo_sum>0 x_Q3= 3*(x_conteo_sum+1)/4. /* Obtener registro o caso del Q3.
EXECUTE.

* Cuartiles: percentiles 25, 50 y 75, es decir, los valores por
debajo de los cuales se encuentra 25%, 50% y 75% de los
casos respectivamente.
* Q1 = 25%(NVAL+1)=3.50.
* Q2 = 50%(NVAL+1)=15.00.
* Q3= 75%(NVAL+1)=45.50.

/* AQUI PONER PROCEDIMIENTO PARA CREAR VARIABLES NUEVAS CON LOS VALORES DE LOS CUARTILES.

I am very grateful to you in advance and I wish you an excellent start to the week.

--
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
Open this post in threaded view
|

## Re: IDENTIFY THE QUARTILLES AND CREATE NEW VARIABLES THOSE VALUES

No puedo dejar de agradecer y comentarles que gracias a sus sugerencias, encontré lo que estaba tratando de hacer.
En efecto Brus, si tengo un error en el Q1 y es que copie el resultado de mi formula que me indica el registro donde esta el Q1 y no el resultado del Q1 que es 8.63

Nota:  Se los escribo en español y una traducción al inglés.

atentamente,

I can't help but thank you and comment that thanks to your suggestions, I found what I was trying to do.

Indeed Brus, if I have an error in Q1 and it is that I copy the result of my formula that indicates the register where Q1 is and not the result of Q1 which is 8.63

Using commands in conjunction with OMS is wonderful.

Thank you very much Jon, for the example.

Note: I am writing them in Spanish and an English translation.

Sincerely,

El mar., 29 sept. 2020 a las 12:54, Javier Figueroa (<[hidden email]>) escribió:

### I thank in general this excellent community of expertsI want to apologize if for any reason the mail gave some misunderstanding.At no time did I want someone to do the procedure for me, much less take advantage of their good deed, I understand that everyone is very busy with their activities and this is something extra, and they do it to help. But in my country Guatemala there are not many experts in SPSS and I believed that I could turn to their knowledge to solve my doubt.I understand that my English language is not very fluent, much less perfect, so "Bad Interpretations" happen.I apologize again and I want to express my gratitude for your support because it is not the first time I have received it, since more than once they have saved my life and because of your suggestions I have been able to learn more.I am not even half her knowledge, but here in Guatemala I am above average and when I can solve a problem I do it with great pleasure, here I am an advanced level! LOL.I hope you have an excellent day and that your activities are being carried out successfully.and remember,if I take care of myself, I take care of others!#JuntosSaldremosAdelante#GuatemalaNoSeDetieneSincerely,

El mar., 29 sept. 2020 a las 11:50, Jon Peck (<[hidden email]>) escribió:
The EXAMINE procedure (Analyze > Descriptive Statistics > Explore)  can give you the IQR,   FREQUENCIES can also give you selected percentiles.  This example uses FREQUENCIES.

dataset name main.
dataset declare stats.
oms select tables /if subtypes='Statistics'
/destination outfile=stats format=sav
/columns dimnames="Statistics".
FREQUENCIES VARIABLES=salary
/FORMAT=NOTABLE
/NTILES=4.
omsend.
compute const=1.
dataset activate stats.
compute const=1.
dataset activate main.
match files /file=* /table=stats/by const
/drop Command_ to Missing @50 const.
exec.

On Tue, Sep 29, 2020 at 11:13 AM Javier Figueroa <[hidden email]> wrote:
Hello spss experts !!!!

I hope everyone is well, as far as possible, with this pandemic it affected the whole world a lot and especially the tourism sector that I consider was the most affected by the covid-19 pandemic.

I am writing to you because I have a situation in a database that I have not been able to solve and that may be something simple but I have turned it around in my head and I have not been able to do it.

I need to create a variable that contains the first quartile (Q1) and the 2nd quartile (MEDIAN) and 3rd quartile (Q3) to then calculate the interqualty range (Q3-Q1)

This result will help me to identify the outliers

this is the syntax i am using.

* Encoding: UTF-8.
/* procedimiento crear base de datos PRUEBA.

data list list
/G_ALOJAMIENTO_D imp_paquete_tur tipoviaj TOTAL.
begin data.
0.00 0 1 1
8.93 0 1 1
67.50 0 2 1
0.00 0 1  1
100.00 0 2 1
0.00 0 1 1
0.00 0 2 1
150.00 0 1 1
0.00 0 2 1
0.00 0 1 1
0.00 0 1 1
16.67 0 1 1
20.00 0 1 1
15.00 0 2 1
8.33 0 2 1
0.00 0 1 1
8.33 0 2 1
0.00 0 2 1
0.00 0 2 1
12.50 0 2 1
0.00 0 2 1
13.33 0 2 1
7.50 0 1 1
0.00 0 2 1
0.00 0 1 1
0.00 0 1 1
0.00 0 2 1
23.51 0 1 1
0.00 0 1 1
0.00 0 2 1
end data.
execute.

numeric id(f8.0).
compute id=\$casenum.
execute.
variable level all (scale).

COMPUTE x_conteo=1.
EXECUTE.

SORT CASES BY G_ALOJAMIENTO_D(A).

TEMPORARY.
SELECT IF G_ALOJAMIENTO_D>0.
FREQUENCIES VARIABLES=G_ALOJAMIENTO_D
/STATISTICS=MEDIAN
/NTILES=4
/PERCENTILES=25.0 50.0 75.0
/ORDER=ANALYSIS.

TEMPORARY.
SELECT IF G_ALOJAMIENTO_D>0.
AGGREGATE
/BREAK=TOTAL
/x_conteo_sum=SUM(x_conteo).

compute x_Q1=0.
compute x_Q2=0.
compute x_Q3=0.
if x_conteo_sum>0 x_Q1= (x_conteo_sum+1)/4. /* Obtener registro o caso del Q1.
if x_conteo_sum>0 x_Q2= (x_conteo_sum+1)/2. /* Obtener registro o caso del Q2.
if x_conteo_sum>0 x_Q3= 3*(x_conteo_sum+1)/4. /* Obtener registro o caso del Q3.
EXECUTE.

* Cuartiles: percentiles 25, 50 y 75, es decir, los valores por
debajo de los cuales se encuentra 25%, 50% y 75% de los
casos respectivamente.
* Q1 = 25%(NVAL+1)=3.50.
* Q2 = 50%(NVAL+1)=15.00.
* Q3= 75%(NVAL+1)=45.50.

/* AQUI PONER PROCEDIMIENTO PARA CREAR VARIABLES NUEVAS CON LOS VALORES DE LOS CUARTILES.

I am very grateful to you in advance and I wish you an excellent start to the week.

--
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

--
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
Open this post in threaded view
|

## Fwd: Rejected posting to SPSSX-L@LISTSERV.UGA.EDU

Open this post in threaded view
|

## Re: Fwd: Rejected posting to SPSSX-L@LISTSERV.UGA.EDU

Open this post in threaded view
|