1. M

    String: Pull characters before "-"

    Hi guys, I have a string variable that looks something like this: MMDC-6MA. I need to extract the first letters before the sign "-", So I need GMDC. Any ideas? Thank you, Marvin
  2. M

    any number at the end of string extraction

    Hi guys, I need to extract the number at the end of a string variable. The problem is that there are also number at the beginning of the string. 200 -300m less than 5 mins 600m less than 5 mins About 10 mins I need 5 5 10 Any help will be greatly appreciate...
  3. L

    Distinct counts / How many different products did a client buy?

    Hi all, I'm still pretty new to SPSS and trying to find my way around the different analyses that are possible. I'm a bit stuck on replicating one analysis I tend to do in Excel, involving distinct counts for a pair of string variables. Imagine that I have the following data set: Client...
  4. A

    Creating index with a string

    So I want to create an index for activity level. We have the following variabeles (I translated a couple of things to english, tis originally in dutch): v18_1 I am a member of: Sportclub v18_2 Ik ben lid van een:Music school v18_3 Ik ben lid van een: Jeugdbeweging v18_4 Ik ben lid van...
  5. M

    clean string variable using other string variables

    Hello Friends, Do you know any good book for string command in stata? I am having trouble understanding the logic of the string commands. I have a dataset of peer-review articles. One variable is the article's study design. My goal is just to have just 3 categories Case-Control...
  6. M

    Delete duplicates based on various variables

    I have a dataset of articles found for a literature review. I have their TITLE, YEAR of PUBLICATION, AUTHOR, and other variables. I know that there are duplicates in my dataset. I would like to delete duplicates based on TITLE, YEAR, AUTHOR. MY title is a string variable and its a little bit...
  7. I

    generating dummy from piece of string

    Hey guys. I'm new to Stata and would really appreciate anyone who can help me. My data is currently in excel and many of the data points contain a numerical value followed by "(s)" indicating the standard error is greater than 40% of that value. My ultimate goal is to get this data into...
  8. C

    Stata 11.0 - Type mismatch r(109) byte to strin variable

    Hello there, I just started working with Stata (Version 11.0). The search in the FAQ and on other pages showed no results so I am trying it here. I have a variable lit (float %21.0g) with the values "Yes, literate" and "No, illiterate". My aim is to create a literacy dummy to work with...
  9. M

    Agency IDs organization

    I would like to locate/organize my valid agency IDs (agencyid). agencyid CA0006 TN0106 NY0009 LA0035 TN0105 TN01o CA0017 cA0006 La0035 The correct structure of the agency ID should be the state letters = 4 numbers ex,. (NY1111)The first thing I wanted to do is to make the first two letter of...
  10. M

    Extract State letters from string variable

    Hi I have a variable that contains numbers and letters. Ideally, participants had to enter their first two state letter - ex. NY- following by certain numbers and letters. 1 NY12OPR 2 OH34789 3 FL3 4 45OHnmo56 5 ny1234 I would like to extract the first to letter of this string...
  11. S

    Auto fill string ID variable

    Hey guys. So I've been working on a project where I need to code a load of surveys. Each survey has (in groups of maybe 100) a specific group identifier and then a personal ID. Something like this: N15-01 N15-02 N15-03 ect. for group one and then again for the next group: N16-01...
  12. J

    Odds of a certain 5 character string occurring in a random string of 512.

    I work in security and recently had a false positive happen where a certain word that was being tested occurred in the session id. Matching is not case sensitive. The character ranges that can be used in the session id: 0-9, A-Z, a-z, +, /. (no comma or period) The security check was...
  13. C

    Meal Coding

    Hi all, I am new to this forum posting. I am currently working on trying to code meals. At the moment I have subjects with seperate rows for each of the foods eaten. There is also a time beside each of these foods, so we know each meal 'sitting', or complete meal eaten. I am wondering is...