Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Merging Datasets using strL

    Hello,

    Do you know how can I merge two datasets using strL variables?

    If it is not possible how can I convert strL to another format?

    As you can see I am new to stata. Thanks for the help!







  • #2
    Rodrigo,

    No, merge key variables cannot be strL.

    The best you could do is probably to figure out the length of the longest string and convert to a string of that size. If that is more than 2045, then you will have to truncate to 2045.

    Code:
    // Figure out longest length
    gen len=length(mergekey)
    summ len
    // Convert to a fixed-length string
    recast str2045 mergekey, force  // If the longest is less than 2045, use that number instead of 2045
    Regards,
    Joe

    Comment

    Working...
    X