LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 21 Nov 2006 14:56:27 -0500
Reply-To:   Brian Kelley <bkelley@LAKESTONEG.COM>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Brian Kelley <bkelley@LAKESTONEG.COM>
Subject:   Basic loop-vector command help?

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.


Back to: Top of message | Previous page | Main SPSSX-L page