Announcement

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

  • No stata.toc file found

    Good morning,
    I am trying to install the egenmore package by downloading it from the SSC archive and then using the command: net install egenmore, from("route\to\package"). I am doing it this way because the computer I am working on does not allow STATA to connect to the website, so packages need to be installed like this. However, when I execute that command I get an error that says that the file is not a Stata download directory (has no stata.toc file).
    Can anybody tell me what to do to solve this problem?
    Thank you in advance.

  • #2
    I don't follow what you're trying here.

    ssc is just a wrapper for net with some extra features. If ssc doesn't work with your set-up, it is hard to see using net directly would work instead.

    In any case route/to/package as syntax doesn't itself explain what you are trying.

    If you managed to copy the egenmore files to one place that you can access, then just use the facilities on your operating system to copy the files to somewhere that Stata can see.

    adopath will show you what PLUS is on your set-up. egenmore.sthlp should be copied to directory or folder e of that and all other files in the package to directory or folder _.

    Comment


    • #3
      I am trying to install the egenmore package so that I can use the sieve() function. The problem is that my computer does not allow for apps to access the internet due to a proxy problem (I have the same problem when using R). So as an alternative, instead of installing egenmore with the command ssc install egenmore, I thought about downloading the egenmore package from the ssc archive and then install it in STATA by accessing the package that I downloaded (I hope that made sense).

      The problem is that when I try to do that there seems to be a problem with the egenmore package that I downloaded, as I still can't seem to be able to install it in STATA.

      I will try your suggestion and see if that works,
      Thank you!

      Comment


      • #4
        Thanks for #2 but it doesn't tell me more than #1 about how and where you put files.

        This is the entirety of _gsieve.ado

        Code:
        *! 1.0.0 NJC 23 Sept 2002 
        program define _gsieve 
                version 7.0
        
                gettoken type 0 : 0
                gettoken g    0 : 0
                gettoken eqs  0 : 0
        
                syntax varname(string) [if] [in] /* 
                */ [, KEEP(str) CHAR(str asis) OMIT(str asis) ] 
        
                local nopts = ("`keep'" != "") + (`"`char'"' != "") + (`"`omit'"' != "")
                if `nopts' != 1 { 
                        di as err "specify keep() or char() or omit()" 
                        exit 198 
                } 
                if `"`omit'"' != "" { 
                        local char `"`omit'"'
                        local not "!" 
                }       
                
                marksample touse, strok
                local type "str1" /* ignores type passed from -egen- */
                qui gen `type' `g' = ""
                local length : type `varlist' 
                local length = substr("`length'",4,.) 
        
                if "`keep'" != "" { 
                        local a 0 
                        local n 0 
                        local o 0 
                        local s 0 
                
                        foreach w of local keep { 
                                local l = length("`w'") 
                                if substr("alphabetic",1,max(1,`l')) == "`w'" {
                                        local a 1     
                                }
                                else if substr("numeric",1,max(1,`l')) == "`w'" {
                                        local n 1 
                                }
                                else if substr("other",1,max(1,`l')) == "`w'" {
                                        local o 1                 
                                }              
                                else if substr("spaces",1,max(1,`l')) == "`w'" {
                                        local s 1  
                                }
                                else {
                                        di as err "keep() invalid" 
                                        exit 198 
                                }
                        } 
               
                        tempvar c  
                
                        quietly {
                                gen str1 `c' = "" 
                                
                                forval i = 1 / `length' {
                                        replace `c' = substr(`varlist',`i',1) 
                        
                                        if `a' { 
                                                replace `g' = `g' + `c' /* 
                                                */ if ((`c' >= "A" & `c' <= "Z") /* 
                                                */ | (`c' >= "a" & `c' <= "z"))
                                        } 
                                        if `n' { 
                                                replace `g' = `g' + `c' /* 
                                                */ if (`c' >= "0" & `c' <= "9")
                                        } 
                                        if `s' {  
                                                replace `g' = `g' + `c' if `c' == " " 
                                        } 
                                        if `o' { 
                                                replace `g' = `g' + `c' /* 
                                                */ if !( (`c' >= "A" & `c' <= "Z") /* 
                                                */ | (`c' >= "a" & `c' <= "z") /* 
                                                */ | (`c' >= "0" & `c' <= "9")  /*                              
                                                */ | (`c' == " ") ) 
                                        }       
                                }
                        }       
                } 
                else { /* char() or omit() */ 
                        forval i = 1 / `length' { 
                                qui replace `g' = `g' + substr(`varlist',`i',1) /* 
                                */ if `not'index(`"`char'"', substr(`varlist',`i',1)) 
                        } 
                } 
        
                qui { 
                        replace `g' = "" if !`touse' 
                        compress `g' 
                }       
        end
        The code has not been touched since 2002, either in public or in private (I wrote it).

        I'd back up and tell us why you want to use it, as some regular expression functionality or destring might be nearer what you might use instead.

        Comment


        • #5
          Thank you for your reply. I put the files in the PLUS directory (the one that STATA points me to when I execute the command adofile), and after some trial and error I found out that the error seems to be the egemore.pkg file in itself. I downloaded the package from the SSC archive, but apparently I did something wrong because I am supposed to have a "_" directory in the same directory where the egenmore.pkg file has been downloaded, and I only have the egenmore.pkg file. Also, after when executing type egenmore.pkg I can see that the .ado files are there, but I am missing a stata.toc file to allow the download.

          I wanted to use it to extract certain characters from a variable that I have, to avoid using complex regular expressions. However, I might just give up and use regular expressions instead, as they will probably be easier.

          I am new to STATA and I am probably doing something wrong, but I don't even know where to look for the mistake.

          Thank you again for your quick reply.

          Comment


          • #6
            Supposing that adopath tells you that PLUS on your set-up is

            Code:
            whatever\maria\ado\plus/
            or something with / separators

            then egenmore.pkg is just a way to organize the download and of no use after download. But

            Code:
            _gsieve.ado
            belongs in

            Code:
            whatever\maria\ado\plus/_
            which you must create if it doesn't exist.

            See

            Code:
            help mkdir

            Comment


            • #7
              If you have Stata on another machine that can access ssc, you could install egenmore on it, and then copy the files onto your problematic machine.

              Or, you can go to

              https://econpapers.repec.org/softwar...de/s386401.htm

              download the files, and then copy the files where Stata can find them. egenmore is sort of a pain, though, because it has so many files and you have to download them one by one.

              I don't know if there is any easy way to copy all the files at once.
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              StataNow Version: 19.5 MP (2 processor)

              EMAIL: [email protected]
              WWW: https://www3.nd.edu/~rwilliam

              Comment


              • #8
                Here's a series of steps that might work for you:

                On your internet-enabled machine, create some folder like /user/me/mystata. Then in Stata on that machine, do this

                Code:
                net query // make a note of the directory listed in front of "ado"; we will change this now and then change it back to this directory later
                net set ado /user/me/mystata
                ssc install egenmore
                net set ado "/the/directory/noted/in/net/query/above"
                Now go to this site on your browser, and download the file egenmore.pkg. Put this file in the folder /user/me/mystata/e.
                In the same folder /user/me/mystata/e, create an empty text file and name it stata.toc. For instance, on a Mac or Unix-based system, you can quickly do this in the Terminal using the command touch. But use any method you want.

                Now copy the entire folder /user/me/mystata to your internet-disabled computer. Say on the new computer, this folder is now /user/metoo/mystata. Now open Stata and do:

                Code:
                net install egenmore, from(/user/metoo/mystata/e)
                And that should do it. The advantage of all this compared to simply copying files into the relevant folders is that Stata will properly track your installation of the egenmore package on the internet-disabled machine, and allow you to update/replace/uninstall it easily in the future.

                Comment

                Working...
                X