Announcement

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

  • help with -logout- command

    Hello,

    I am having some difficulty using the -logout- command in a loop that I am trying to run. I have installed the command and have checked that it is install:

    **


    checking logout consistency and verifying not already installed...
    all files already exist and are up to date.

    **

    However, when I run my loop on the data (see below), it comes up with an error (also below):

    *****


    . cd "\\tsclient\C\Users\higginsm\Desktop"
    \\tsclient\C\Users\higginsm\Desktop

    .
    . set more off

    .
    . import excel logouttest.xlsx, sheet("Sheet1") firstrow clear

    .
    . drop in 189/l
    (1 observation deleted)

    .
    . set type double, permanently
    (set type preference recorded)

    .
    . destring, replace
    time contains nonnumeric characters; no replace
    ip already numeric; no replace
    lanagra already numeric; no replace
    nrsth already numeric; no replace

    .
    . gen myd=monthly(time, "YM")

    .
    . format myd %tm

    .
    . format %tmMon_CCYY myd

    .
    . tsset myd, monthly
    time variable: myd, Jan 2000 to Aug 2015
    delta: 1 month

    .
    . foreach v of varlist ip lanagra nrsth {
    2. sbbq `v', w(6) p(6) c(15)
    3. egen min_`v' = min(`v')
    4. logout, save(`v') excel fix replace: list myd `v'_point `v' if inlist(`v'_point,1,-1)
    5. }
    (188 missing values generated)
    3 peaks and 3 troughs found

    +-----------------------------+
    | myd ip_point ip |
    |-----------------------------|
    24. | Dec 2001 -1 90.8 |
    38. | Feb 2003 1 94.4 |
    69. | Sep 2005 -1 98 |
    95. | Nov 2007 1 105.2 |
    114. | Jun 2009 -1 87.2 |
    |-----------------------------|
    180. | Dec 2014 1 107.9 |
    +-----------------------------+
    fixcut(5 7 11 18 29 35 45)

    invalid 'Settings'
    r(198);

    end of do-file

    r(198);

    ***



    Have I mis-specified the -logout- code? or is it possible that I have some file or path destination that is incorrect?

    Thank you very much for your help,

    Michael


  • #2
    logout is from SSC, as the FAQ asks you to mention. Please add
    Code:
    set trace on
    before the loop and then run the commands again. Please use CODE tags (explained in the FAQ) when you show us the output.

    Comment


    • #3
      Michael,

      Friedrich made the same suggestion I was going to. I don't see anything particularly wrong with your code, but a trace will reveal exactly where the problem is (although you may have to sift through a lot of output to find it).

      I did try to replicate your problem and couldn't, although I did get a different error when tracing. In poking around the ado-file for logout I see that it was last updated in 2009 and was built for Stata 7 or 8. Accordingly, I would be wary of using this program. I tried to use the same syntax you did for the auto data set and it output XML files that didn't seem quite right when opened into Excel.

      Regards,
      Joe

      Comment


      • #4
        P.S.

        It is also not entirely obvious to me why you need to use logout in the first place, when all you are doing is listing variables. Why not just use export excel? For example:

        Code:
        foreach v of varlist ip lanagra nrsth {
          sbbq `v', w(6) p(6) c(15)
          egen min_`v' = min(`v')
          export excel myd `v'_point `v' if inlist(`v'_point,1,-1) using `v'.xlsx, replace first(var)
        }

        Comment

        Working...
        X