+ Reply to Thread
Results 1 to 2 of 2

Creating a unique code for each variable (importing into SPSS)

  1. #1
    Registered User
    Join Date
    03-03-2015
    Location
    Canada
    MS-Off Ver
    2011
    Posts
    1

    Creating a unique code for each variable (importing into SPSS)

    I was wondering if anyone could explain to me how to carry though with this process/ formulae in Excel 2011. I currently have numerous columns of data, with Column A containing names of locations (i.e. A1 = CITY NAME, A2 = City1, etc.. A15 = City14), and column B with no information, just a label in B1 called CITY CODE. The process I am suppose to carry through with was sent to me in an email stating that I must:

    "in the Excel file you can put the city name under the name variable but then you need a separate variable which contains a unique code for each city. each city might have a code already, or you can create your own, but it must be a number only"

    Now, I thought I could just create a =VLOOKUP, but I am not sure if a =VLOOKUP formulae would transfer into SPSS properly. I also thought I could use the =IF formulae.. but again I am not sure if these would transfer over properly into SPSS.

    What I simply did was put numbers 1-14 down the B column across from the name.. in my mind assigning it my own code haha.. I don't think this is right though.

    What I want is to simply type in 13 in a cell and BAM get the name for cell A14.. Is this possible without VLOOKUP or IF.. if those are even the right formulae?

    I know excel doesn't work like this, but what I want is A2=1, A3=2, so when I type in 1, I get A2. This could totally be wrong for importing into SPSS, I just can't see it in any other way. For those unaware, SPPS is a statistical program.. and in SPSS you cannot have any text data only numeric.. and as such you need to have all text coded to numeric values or "codes" so in the program, a 1=yes, 2=no, 3=no answer for survey type stat stuff for ex.

    Thanks.
    Last edited by Mackwa; 03-03-2015 at 01:31 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Creating a unique code for each variable (importing into SPSS)

    Hi, welcome to the forum

    This sounds like a homework assignment?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Stuck with VBA Code. Creating a unique reference number with each macro click
    By blackburnsexcel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-27-2014, 09:02 AM
  2. VBA code - importing text file to excel - variable filename!
    By 2010snowbeach in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 08-10-2014, 01:16 AM
  3. Compute New Variable(column) with If Statements - Like in SPSS/Stata/Etc.
    By as3ad in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2014, 05:55 PM
  4. Error 91 object variable block variable not set when importing a CVS file
    By ReportBuilder2011 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2011, 11:48 AM
  5. VBA - Creating a unique code from a name
    By wirewolf86 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-16-2010, 06:09 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1