Announcement

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

  • Roman numerals inside a text string

    Hello. Could someone give me some trick to detect roman numerals inside a text string? I have looked at the options with the regular expressions, but I can't think of any... thanks

  • #2
    See https://www.stata-journal.com/articl...article=dm0054 which may help.

    Comment


    • #3
      I have this data:

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input str13 var
      "VICTORIA)"    
      "S"            
      "UNIDAS)"      
      "DE"           
      "UNION"        
      "JARA"         
      "PARRA"        
      "PUCARA"       
      "CORDILLERILLA"
      "LABRANZA)"    
      "AROMOS)"      
      "LAS"          
      "IMPERIAL)"    
      "ROZAS)"       
      "LIDER)"       
      "NUEVO)"       
      "ORIENTE"      
      "1)"           
      "4)"           
      "BARRERA"      
      end
      and I have this error message:

      . fromroman var, gen(x)
      subinstr(): 3200 conformability error
      from_roman(): - function returned error
      <istmt>: - function returned error
      r(3200);


      Perhaps the variable has some data that makes it difficult to use the command? Because I used the command on other text variables and it worked perfect.

      Thank you so much

      Comment


      • #4
        I can’t see any Roman numerals in your example data and in any case the command does not deal with text that includes anything else.

        Comment


        • #5
          Does it mean that the command does not work well if the variable does not contain any roman numerals? Ok, I can fix it by doing some sort of rustic fix to my do-file because I need that possibility to be actually considered, but the command will be extremely useful anyway. Thank you very much again!

          Comment


          • #6
            I can't follow #5. If a variable does not contain any roman numerals, there is nothing to do so far as fromroman is concerned, but it will throw an error.

            Comment

            Working...
            X