|
I'm new to SPSS, and would appreciate some help on a very basic question.
I would like to be able to read in a list of state FIPS codes and
abbreviations, then use that in a "Do if" statement to computer another
variable in a large SPSS file that I have. I know that this is simple, but
after many hours I'm just stuck. I can't seem to understand how the vector
command works, its not like any array variable I've ever used before. I'm
trying to create a two-dimensional array, then read from the array,
replace some values in the "Do if" loop, and then compute a new variable,
but my I'm missing something basic here. Here's the code. Any help would
be greatly appreciated.
thanks, Brian
Data List /State_FIPS2 1-2 (A) State_Abbr2 3-4 (A).
Begin Data
01AL
02AK
04AZ
05AR
06CA
08CO
End Data.
*Some kind of vector command?.
*Some kind of loop comand?.
*I would like to be able to use vectors and loops to insert the
appropriate state abbreviation and state fips code into the following if
loop, rather than type out the following replacement/compute command 51
times.
*Help!.
Do if (To_St = "00") & (To_State_Abbr = "AL").
Compute To_St_2 = "01".
Else if (To_St = "00") & (To_State_Abbr = "AK").
Compute To_St_2 = "02".
End if.
Execute.
|