Sie sind auf Seite 1von 8

EQ o = “Igual” Selecting and Modifying the Data:

NE o <> “Distinto”
LT o < “Menor que” Esta parte es opcional. This part is optional. Puede que no necesite para sele
Le o <= “Menor o igual que” hacer, estos son los comandos más comunes. do, these are the most commo
GT o >”Mayor que”
GE o >= “Mayor o igual que” 1. SELECT IF - Este comando selecciona CASOS conjunto, por lo general
AND o & “Operador y lógico”
OR o | “Operador o lógico” Ejemplos: SELECT si (sexo = 1). Examples: SELECT IF (sex = 1).
Not “Negación lógica SELECCIONAR SI (ESTADO = "Nueva Jersey"). SELECT IF (STATE =
seleccionar si (cualquiera (racegrp, 4,5,6,8)). select if (any(racegrp,4,5,6,8

Advertencia: El efecto de múltiples SELECT IF las declaraciones son acum


la TEMPORARY comando si no queremos que este. the TEMPORARY co

2. COMPUTE - Crear una nueva variable. COMPUTE - Create a new varia

Ejemplos: COMPUTE NewAge = 0. Examples: COMPUTE NEWAGE=0.


COMPUTE YRRETIRE BIRTHYR = 65. COMPUTE YRRETIRE=BIRT
Calcular los ingresos salariales de interés = + + divdnds. COMPUTE INCO

3. RECODE - Cambiar los valores de una variable. RECODE - Change the


uno viejo para que no pierdan los valores antiguos. an old one so you don
y utilizarlos de nuevo. and use them again. El formato predeterminado pa
haciendo esto más eficiente con el comando FORMAT. making this more

Ejemplo: RECODE EDAD (MISSING = 9) (18 al HI = 1) (BAJA al 18 = 0) en lo


LUGAR RECODE (1 = 1) (2 a 7 = 2) (otra cosa = 0) en CITYTOWN. RE
RECODE MES ("" = 99) (CONVERT) ("-"= )("&"= 11 12) en NEWMON
FORMATOS CITYTOWN VOTANTE (F1.0) NEWMONTH (F2.0) FOR

4. IF - Conditional change. This is useful for cleaning data as well as recoding (

Ejemplos: COMPUTE WORKWK = 0. Examples: COMPUTE WORKWK=0.


SI (GT TRABAJO TRABAJO LE 0 y 35) WORKWK = 1. IF (WORK GT
Comput PLRTY = 1. COMPUT PLRTY = 1.
SI (RANGO (VALUE PLURALTY), 2,8) = 2 PLRTY. IF RANGE(VALU
SI ("EQ ESTADO JN") ESTADO = "Nueva Jersey". IF (STATE EQ "JN"

5. MISSING VALUES - Que se declare algunos valores de una variable "q


cálculos estadísticos. statistical calculations.

Ejemplo: los valores que faltan EDAD (0) Example: MISSING VALUES AGE
Score1 a Score10 (999) Score1 to Score10 (999)
ESTADO ("XX"). STATE ("XX").

Advertencia: Valores perdidos afectan RECODE y COMPUTE declaracion


resultados. results. Al crear o modificar cualquier variable asegúrese de r
ocurrió con los valores que faltan. happened with the Missing Values. Po

MISSING PLURALTY VALUES (2 a 8). MISSING VALUES PLURALT


PLRTY COMPUTE = PLURALTY. COMPUTE PLRTY=PLURALTY.
PLRTY RECODE (2 a 8 = 2). RECODE PLRTY (2 THRU 8 = 2).

no funcionará. won't work. Los casos codificados del 2 al 8 se han perdido


para el VALUE función para evitar esto.) for the VALUE function to get a
al. Puede que no necesite para seleccionar los casos o modificar o crear nuevas variables. You may not need to select cases or modify
nes. do, these are the most common commands.

na CASOS conjunto, por lo general la gente. SELECT IF - This command selects whole CASES, usually people.

es: SELECT IF (sex = 1).


Nueva Jersey"). SELECT IF (STATE = "NJ").
4,5,6,8)). select if (any(racegrp,4,5,6,8)).

LECT IF las declaraciones son acumulativos. Warning! The effect of multiple SELECT IF statements is cumulative. Consulte el manual
mos que este. the TEMPORARY command if you don't want this.

ble. COMPUTE - Create a new variable.

mples: COMPUTE NEWAGE=0.


R = 65. COMPUTE YRRETIRE=BIRTHYR+65.
nterés = + + divdnds. COMPUTE INCOME=salary+interest+divdnds.

na variable. RECODE - Change the values of a variable. Es mejor hacer esto en una nueva variable creada a partir de It is best to do thi
res antiguos. an old one so you don't lose the old values. Uno nunca sabe cuando puede tener una copia de seguridad You never know
gain. El formato predeterminado para variables de tipo entero nuevo F8.2. The default format for new integer variables is F8.2. Vale la
mando FORMAT. making this more efficient with the FORMAT command.

) (18 al HI = 1) (BAJA al 18 = 0) en los votantes. Example: RECODE AGE (MISSING=9)(18 thru HI=1)(LOW thru 18=0) into VOTER.
2) (otra cosa = 0) en CITYTOWN. RECODE PLACE (1=1)(2 thru 7=2)(else=0) into CITYTOWN.
RT) ("-"= )("&"= 11 12) en NEWMONTH RECODE MONTH (" "=99) (CONVERT) ("-"=11)("&"=12) into NEWMONTH
NTE (F1.0) NEWMONTH (F2.0) FORMATS VOTER CITYTOWN (F1.0) NEWMONTH (F2.0)

for cleaning data as well as recoding (3rd example below). IF - Conditional change. This is useful for cleaning data as well as recoding (3rd example

amples: COMPUTE WORKWK=0.


0 y 35) WORKWK = 1. IF (WORK GT 0 and WORK LE 35) WORKWK=1.

), 2,8) = 2 PLRTY. IF RANGE(VALUE(PLURALTY),2,8) PLRTY = 2.


= "Nueva Jersey". IF (STATE EQ "JN") STATE="NJ".

algunos valores de una variable "que falta" para que no se utilizarán en MISSING VALUES - Declare some values of a variable "missin

Example: MISSING VALUES AGE (0)


ore1 to Score10 (999)

RECODE y COMPUTE declaraciones inesperadas y pueden tener Warning! Missing Values affect RECODE and COMPUTE statements
r cualquier variable asegúrese de revisar con mucho cuidado lo que When you create or modify any variable be sure to check very car
pened with the Missing Values. Por ejemplo: For example:

2 a 8). MISSING VALUES PLURALTY (2 THRU 8).


. COMPUTE PLRTY=PLURALTY.
ODE PLRTY (2 THRU 8 = 2).

odificados del 2 al 8 se han perdido y no ser recodificados. (Consulte el Manual de Cases coded 2 through 8 are Missing and won't be r
o.) for the VALUE function to get around this.)
ed to select cases or modify or create new variables. Pero si usted But if you

mulative. Consulte el manual sobre el uso de See the manual on using

a partir de It is best to do this on a new variable created from


e seguridad You never know when you may have to backup
ger variables is F8.2. Vale la pena It's worth

18=0) into VOTER.

well as recoding (3rd example below).

e values of a variable "missing" so they won't be used in

E and COMPUTE statements and can have unexpected


ble be sure to check very carefully what

8 are Missing and won't be recoded. (See the Manual


Some other nice (but optional) commands:

TITLE

SET WIDTH 80
SET HEADER NO
N OF CASES x
SAMPLE [percent]
SAMPLE [n from m]

COMMENT

*
but optional) commands:

Pone una línea del título en su salida. Puts a title line on your output.
Reducir el ancho de la salida de esta manera puede leerlo en una pantalla de ordenador. Narrow the width of the output so yo
easily read it on a computer screen.
Apague las partidas página tras página 1. Turn off the page headings after page 1.
Ejecutar en "x" número de casos para probar el programa. Run on x number of cases to test the program.
Tomar una muestra porcentaje de casos. Take a percentage sample of cases.
Tomar una muestra de n casos de los casos m. Take a sample of n cases from m cases.
Escriba un comentario líneas en su programa. Muy recomendable. El comentario puede extenderse por varias líneas hasta qu
con un punto. Write a comment lines in your program. Highly recommended. The comment can extend for many lines until it
with a period.

Suplente manera de empezar las líneas de comentarios. Alternate way to start comment lines.

Das könnte Ihnen auch gefallen