Announcement

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

  • errors when using isko to transfer ISCO-88 to ISEI

    Hi, when I use isko command to transfer ISCO-88 to ISEI, I first have the following error.
    iskoisei fisei, isko(focc)
    command B is unrecognized
    (error occurred while loading iskoisei.ado)
    r(199);

    end of do-file


    After I delete letter B in the ado file, I have the following error, which I do not know how to solve. Thanks for your help.

    iskoisei fisei, isko(focc)
    program error: code follows on the same line as open brace
    (error occurred while loading iskoisei.ado)
    r(198);

    end of do-file

  • #2
    Yapeng Wang,

    when I ask Stata what is iskoisei it says it doesn't know:

    Code:
    . which iskoisei
    command iskoisei not found as either built-in or ado-file
    r(111);
    Hence see #12.1 here.

    Best, Sergiy Radyakin

    Comment


    • #3
      I have the ado from here: http://fmwww.bc.edu/repec/bocode/i/iskoisei.ado
      Defining the program does also give the 'command B is unrecognized' error, but the program runs with or without the unnecesary B in the ado that defines the program.
      Are you using the line 'iskoisei fisei, isko(focc)' as part of a longer ado? Tell us about that if so.

      Comment


      • #4
        Inspecting the file at the URL provided by Jorrit Gosens shows that it has the command B at the end of the file. This is likely a typo or a data transfer issue, which prevents the program from being executed correctly.

        You can contact the author or the SSC archive coordinator to have it fixed by removing that command. As a workaround you can also define your own B command
        Code:
        program define B
          // do nothing
        end
        to prevent the error from showing up with the current version. Place it in B.ado somewhere along the ado search path.

        Best, Sergiy Radyakin

        Comment


        • #5
          B appears after the end statement, so I am surprised that Stata tries to execute it ...

          Edit: well, I should not be surprised since end is not exit ..., sorry.

          Best
          Daniel
          Last edited by daniel klein; 14 Feb 2018, 07:44.

          Comment


          • #6
            The 'B' error is only an issue with th ado defining the program, but as Daniel says, it's after the program definition ends. So this doenst matter. The program was defined okay even with the 'B' error. The problem lies elsewhere.

            Comment


            • #7
              The problem is probably related to issue 1428168. There is no line break at the end of the ado file, so the letter B that is there is not visible to Stata, when it loads the original ado file. Here is an example:

              Code:
              . clear all
              
              . set obs 1
              number of observations (_N) was 0, now 1
              
              . gen i=8400
              
              . iskoisei y , isko(i)
              
              . l
              
                   +-----------+
                   |    i    y |
                   |-----------|
                1. | 8400   24 |
                   +-----------+
              I believe that Yapeng Wang has probably copied the content of the ado file into his do file, in which case the B will be a command since it will be followed by his own commands. The error quoted by him refers to a brace { which is nowhere to find in the original file. So it must be something else. Running with trace on should expose the erroneous code.


              Daniel, one ado file can define multiple programs. Look at ados for graphing commands for examples. Also ados may include mata code that needs to be compiled on the fly when the command is to be prepared.

              Comment


              • #8
                After some detective work, I see that
                Code:
                net describe isko, from(http://fmwww.bc.edu/RePEc/bocode/i)
                net describe isco, from(http://fmwww.bc.edu/RePEc/bocode/i)
                seem to describe the identical package, with isko dated 20041020 and isco dated earlier at 20020528. However after installing both packages using ssc install I see that
                Code:
                viewsource iskoisei.ado
                viewsource iscoisei.ado
                tells me that iskoisei is dated 15jun2001 and iscoisei later at 18jun2001. For some other components of the isko/isco packages, the isko version is later than the isco version, as would be expected from the package release dates.

                My recommendation would be to install isco and use iscoisei rather than iskoisei.

                Comment


                • #9
                  Both isco and isko are available from SSC. From the help file for iscoisei:
                  The isco package consists of a series of programs to recode ISCO-68
                  and from the help file for iskoisei:
                  The isko package consists of a series of programs to recode ISCO-88
                  So if the OP wants to convert ISCO-88 codes, the isko package is the one to use.

                  I can replicate the issue in #1:
                  Code:
                  . cap ado uninstall isko
                  
                  . 
                  . ssc install isko
                  checking isko consistency and verifying not already installed...
                  installing into /Users/robert/Library/Application Support/Stata/ado/plus/...
                  installation complete.
                  
                  . 
                  . * Example generated by -dataex-. To install: ssc install dataex
                  . clear
                  
                  . input int focc
                  
                           focc
                    1. 1110
                    2. 1141
                    3. end
                  
                  . 
                  . iskoisei fisei, isko(focc)
                  command B is unrecognized
                  (error occurred while loading iskoisei.ado)
                  r(199);
                  
                  end of do-file
                  The last few lines of "iskoisei.ado" are (and include an end of line character on the last line)
                  Code:
                      quietly replace `varlist'=22 if (`isko' == 9331)
                      quietly replace `varlist'=22 if (`isko' == 9332)
                      quietly replace `varlist'=30 if (`isko' == 9333)
                  end
                  B
                  If you copy "iskoisei.ado" to the current directory and remove the offending "B" at the end of the ado file, you do not get the error anymore since the offending command has been removed.

                  If I leave the "B" but remove the final end of line character, I get no error. So it looks like this may indeed be related to the issue of code on the last line without an end of line character (as pointed out by Sergiy) and the outcome depends on how the file was downloaded. No matter what, extra text at the end of a do-file will produce an error if it is not valid Stata code. For example, save the following in a file called "whatsup.ado" in the current directory:
                  Code:
                  program whatsup
                      dis "hello"
                  end
                  noi dis "this is valid code"
                  saywhat
                  If you try to run the program, you get:
                  Code:
                  . whatsup
                  this is valid code
                  command saywhat is unrecognized
                  (error occurred while loading whatsup.ado)
                  r(199);
                  So the author should be contacted so that he can remove the offending "B".

                  Comment


                  • #10
                    Originally posted by Sergiy Radyakin View Post
                    Yapeng Wang,

                    when I ask Stata what is iskoisei it says it doesn't know:

                    Code:
                    . which iskoisei
                    command iskoisei not found as either built-in or ado-file
                    r(111);
                    Hence see #12.1 here.

                    Best, Sergiy Radyakin
                    Sorry, I did not make it clear. It is from a SSC installed package isko in STATA 14.2

                    Comment


                    • #11
                      Originally posted by Jorrit Gosens View Post
                      I have the ado from here: http://fmwww.bc.edu/repec/bocode/i/iskoisei.ado
                      Defining the program does also give the 'command B is unrecognized' error, but the program runs with or without the unnecesary B in the ado that defines the program.
                      Are you using the line 'iskoisei fisei, isko(focc)' as part of a longer ado? Tell us about that if so.
                      Thank you. No, when I installed the package, I just ran the command iskoisei fisei, isko(focc) as shown in the help isko window.

                      Comment


                      • #12
                        Originally posted by Yapeng Wang View Post
                        Hi, when I use isko command to transfer ISCO-88 to ISEI, I first have the following error.
                        iskoisei fisei, isko(focc)
                        command B is unrecognized
                        (error occurred while loading iskoisei.ado)
                        r(199);

                        end of do-file


                        After I delete letter B in the ado file, I have the following error, which I do not know how to solve. Thanks for your help.

                        iskoisei fisei, isko(focc)
                        program error: code follows on the same line as open brace
                        (error occurred while loading iskoisei.ado)
                        r(198);

                        end of do-file
                        Thanks. But after I put the B.ado file in the ado folder, I got following error
                        Code:
                        iskoisei fisei,isko(focc)
                        program error:  code follows on the same line as open brace
                        (error occurred while loading B.ado)
                        (error occurred while loading iskoisei.ado)

                        Comment


                        • #13
                          Originally posted by Sergiy Radyakin View Post
                          The problem is probably related to issue 1428168. There is no line break at the end of the ado file, so the letter B that is there is not visible to Stata, when it loads the original ado file. Here is an example:

                          Code:
                          . clear all
                          
                          . set obs 1
                          number of observations (_N) was 0, now 1
                          
                          . gen i=8400
                          
                          . iskoisei y , isko(i)
                          
                          . l
                          
                          +-----------+
                          | i y |
                          |-----------|
                          1. | 8400 24 |
                          +-----------+
                          I believe that Yapeng Wang has probably copied the content of the ado file into his do file, in which case the B will be a command since it will be followed by his own commands. The error quoted by him refers to a brace { which is nowhere to find in the original file. So it must be something else. Running with trace on should expose the erroneous code.


                          Daniel, one ado file can define multiple programs. Look at ados for graphing commands for examples. Also ados may include mata code that needs to be compiled on the fly when the command is to be prepared.
                          Thank you! I did not copy and paste the ado file to my dofile, and I do not know why there is an error about the open brace when I delete the B from the original ado file.

                          Comment


                          • #14
                            Originally posted by Robert Picard View Post
                            Both isco and isko are available from SSC. From the help file for iscoisei:
                            and from the help file for iskoisei:

                            So if the OP wants to convert ISCO-88 codes, the isko package is the one to use.

                            I can replicate the issue in #1:
                            Code:
                            . cap ado uninstall isko
                            
                            .
                            . ssc install isko
                            checking isko consistency and verifying not already installed...
                            installing into /Users/robert/Library/Application Support/Stata/ado/plus/...
                            installation complete.
                            
                            .
                            . * Example generated by -dataex-. To install: ssc install dataex
                            . clear
                            
                            . input int focc
                            
                            focc
                            1. 1110
                            2. 1141
                            3. end
                            
                            .
                            . iskoisei fisei, isko(focc)
                            command B is unrecognized
                            (error occurred while loading iskoisei.ado)
                            r(199);
                            
                            end of do-file
                            The last few lines of "iskoisei.ado" are (and include an end of line character on the last line)
                            Code:
                             quietly replace `varlist'=22 if (`isko' == 9331)
                            quietly replace `varlist'=22 if (`isko' == 9332)
                            quietly replace `varlist'=30 if (`isko' == 9333)
                            end
                            B
                            If you copy "iskoisei.ado" to the current directory and remove the offending "B" at the end of the ado file, you do not get the error anymore since the offending command has been removed.

                            If I leave the "B" but remove the final end of line character, I get no error. So it looks like this may indeed be related to the issue of code on the last line without an end of line character (as pointed out by Sergiy) and the outcome depends on how the file was downloaded. No matter what, extra text at the end of a do-file will produce an error if it is not valid Stata code. For example, save the following in a file called "whatsup.ado" in the current directory:
                            Code:
                            program whatsup
                            dis "hello"
                            end
                            noi dis "this is valid code"
                            saywhat
                            If you try to run the program, you get:
                            Code:
                            . whatsup
                            this is valid code
                            command saywhat is unrecognized
                            (error occurred while loading whatsup.ado)
                            r(199);
                            So the author should be contacted so that he can remove the offending "B".
                            Thank you! I did remove the B from the adofile. But after I removed it, stata reported an error about open brace. I will contact the author.

                            Comment


                            • #15
                              Now I copy and paste the ado file command into my dofile. After I run it, I get the result that I want. I will provide the author's reply when I receive it. Thank you all very much!

                              Comment

                              Working...
                              X