Announcement

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

  • ERROR type mismatch

    Hi, i'm doing a bibliometric analysis
    By entering the command "wosaddress (name file.dta) gives me an error

    The error is type mismatch r(109)

    What should I do?
    thank you

  • #2
    I have never used this user contributed command, but by simply looking at the help file, I do not see any examples of the syntax that you are trying.

    You should look at the help file for the syntax of the command, and look at the examples at the bottom.

    Probably you need to write something like

    Code:
     wosaddress file.dta

    Comment


    • #3
      Let me add to Joro's analysis. I see that the (minimal) output of help wosaddress tells us the syntax is
      Code:
      wosadress [filename]
      If you are new to Stata, you may not realize that the square brackets around filename are not meant to be taken literally; they indicate that the filename is optional.

      If you scroll down to the examples, you'll see that brackets are not used.

      If the file name is actually "name file.dta" with an embedded space, you will need to surround the file name with quotation marks
      Code:
      wosaddress "name file.dta"
      But I will say that the error message was not particularly helpful.
      Last edited by William Lisowski; 30 Apr 2021, 16:16.

      Comment


      • #4
        My file is called finished_file2.dta
        and i use the command

        Code:
        wosaddress finished_file2
        but there is always the error

        Comment


        • #5
          Probably we will not be able to help you, and if you really need this command, you will have to write to the authors of the command.

          But if you want type

          Code:
          set trace on
          then execute the command again.

          Look up through the lines of code until you find the message in red. Copy and paste here, about 5 lines before and 5 lines after the message in red, and use proper formatting (the sharp symbol # on the menu above) when you are pasting it here.



          Comment


          • #6
            I agree with Joro. The error you are seeing suggests that in the heart of wosaddress it has tried to set a numeric variable to a string value, or vice versa. Good programming practice would have confirmed that the two agreed. This might reflect a problem in your input dataset, but that should have been prepared by the author's wosload command.

            I suspect you need to reread the authors' paper with a full description and be sure you followed all the necessary steps, and then email the authors at the addresses given in the help files.

            Comment


            • #7
              Thank you very much
              These are the lines before and after the error

              Code:
              - g id_wos = _n
              - local varcount = c1_count - 1 in 1
              - forvalues x = 1(1)`varcount' {
              = forvalues x = 1(1)4 {
              - g splitvar`x' = (strpos(c1_`x',"]") < strpos(c1_`x',"[") | (strmatch(c1_`x',"*]*") & strmatch(c1_`x',
              > "*[*")==0))
              = g splitvar1 = (strpos(c1_1,"]") < strpos(c1_1,"[") | (strmatch(c1_1,"*]*") & strmatch(c1_1,"*[*")==0)
              > )
              - replace c1_`x' = substr(c1_`x',strpos(c1_`x',"]")+1,.) if splitvar`x'
              = replace c1_1 = substr(c1_1,strpos(c1_1,"]")+1,.) if splitvar1
              - replace long_addr`x' = 0 if splitvar`x'
              = replace long_addr1 = 0 if splitvar1
              type mismatch
                }
                forvalues x = 0(1)`varcount' {
                count if strmatch(c1_`x',"*[*]*")
                while r(N) != 0 {
                replace c1_`x' = subinstr(c1_`x',substr(c1_`x',strpos(c1_`x',"["),strpos(c1_`x',"]")-strpos(c1_`x',"[
              > ")+1),"",.) if strmatch(c1_`x',"*[*]*")
                count if strmatch(c1_`x',"*[*]*")
                }
                replace c1_`x' = substr(c1_`x',1,strpos(c1_`x',"[")-1) if strmatch(c1_`x',"*[*")==1
                }
                forvalues j = 0(1)`varcount' {
                split c1_`j', parse(";") g(c1_`j'_)
                rename c1_`j' long_c1_`j'
                local varmax = r(nvars)

              Comment


              • #8
                This think the code is trying to change a string variable to assigned numerical value of 0, something like this
                Code:
                . clear
                
                . set obs 1
                number of observations (_N) was 0, now 1
                
                . gen long_addr1 = "bla"
                
                . gen one = 1
                
                . replace long_addr1 = 0 if one
                type mismatch
                r(109);
                and this is not allowed in Stata.

                Write to the authors of the package and let them know about the problem.

                Comment

                Working...
                X