Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: dolog with svyset


From   Danielle H Ferry <[email protected]>
To   [email protected]
Subject   st: dolog with svyset
Date   Wed, 05 Jan 2005 13:47:02 -0500

Hi all,
I am having a problem using "dolog" when the "svyset" command is contained in the do-file. You can see the error below. Does anyone know why this happens? It runs fine when I just type "do [filename]". Is there a solution?
Thanks,
Danielle


-------------------------------------------------------------------------------
log: D:\dhferry\cu_sph\churn\analysis\testdolog.log
log type: text
opened on: 5 Jan 2005, 13:45:44
- display "Log file `1'.log opened on $S_DATE at $S_TIME"
= display "Log file testdolog.log opened on 5 Jan 2005 at 13:45:44"
Log file testdolog.log opened on 5 Jan 2005 at 13:45:44
- capture noisily do `0'
= capture noisily do testdolog

. use ../gruntwork/churn, clear

.
. egen psu = concat(dupersid panel)
------------------------------------------------------------ begin egen ---
- version 6
- gettoken type 0 : 0, parse(" =(")
- gettoken name 0 : 0, parse(" =(")
- if `"`name'"'=="=" {
= if `"="'=="=" {
- local name `"`type'"'
= local name `"psu"'
- local type : set type
- }
- else {
gettoken eqsign 0 : 0, parse(" =(")
if `"`eqsign'"' != "=" {
error 198
}
}
- confirm new variable `name'
= confirm new variable psu
- gettoken fcn 0 : 0, parse(" =(")
- gettoken args 0 : 0, parse(" ,") match(par)
- if `"`par'"' != "(" {
= if `"("' != "(" {
exit 198
}
- if `"`args'"' == "_all" {
= if `"dupersid panel"' == "_all" {
version 7.0
unab args : _all
local args : subinstr local args "`_sortindex'" "", all word
version 6.0
}
- syntax [if] [in] [, *]
- if _by() {
local byopt "by(`_byvars')"
local cma ","
}
- else if `"`options'"' != "" {
= else if `""' != "" {
local cma ","
}
- tempvar dummy
- global EGEN_Varname `name'
= global EGEN_Varname psu
- capture noisily _g`fcn' `type' `dummy' = (`args') `if' `in' `cma' `byopt'
> `options'
= capture noisily _gconcat float __000001 = (dupersid panel)
------------------------------------------------------ begin _gconcat ---
- version 7
- local strlen = cond("$S_StataSE"=="", "80", "244")
= local strlen = cond("SE"=="", "80", "244")
- version 6.0
- gettoken type 0 : 0
- gettoken g 0 : 0
- gettoken eqs 0 : 0
- syntax varlist(min=1) [if] [in], [Punct(str) Decode MAXLength(str) Form
> at(str) BY(string)]
- if `"`by'"' != "" {
= if `""' != "" {
_egennoby concat() `"`by'"'
}
- tempvar xy
- gen `xy'=1
= gen __000002=1
- if "`format'" != "" {
= if "" != "" {
capture format `xy' `format'
if _rc == 120 {
noi di in r "Invalid format"
exit 120
}
local format `","`format'""'
}
- local plen = length(`"`punct'"')
= local plen = length(`""')
- local type "str1"
- if "`maxleng'" != "" {
= if "" != "" {
capture confirm integer n `maxleng'
if _rc | `maxleng' < 1 | `maxleng' > `strlen' {
di in r "invalid maxlength( )"
exit 198
}
else {
local maxleng "maxl(`maxleng')"
}
}
- local decode = "`decode'" == "decode"
= local decode = "" == "decode"
- quietly {
- gen `type' `g' = ""
= gen str1 __000001 = ""
- tokenize `varlist'
= tokenize dupersid panel
- while "`1'" != "" {
= while "dupersid" != "" {
- capture confirm string variable `1'
= capture confirm string variable dupersid
- if _rc {
local decoded 0
if `decode' {
tempvar dcdd
capture decode `1', gen(`dcdd') `maxleng'
if _rc == 0 {
replace `dcdd' = string(`1'`format') if `dcdd' == ""
replace `g' = `g' + `dcdd' + `"`punct'"' `if' `in'
local decoded 1
}
capture drop `dcdd'
}
if !`decoded' {
replace `g' = `g' + string(`1'`format') + `"`punct'"' `if' `in'
}
}
- else {
- replace `g' = `g' + `1' + `"`punct'"' `if' `in'
= replace __000001 = __000001 + dupersid + `""'
- }
- mac shift
- }
- while "`1'" != "" {
= while "panel" != "" {
- capture confirm string variable `1'
= capture confirm string variable panel
- if _rc {
- local decoded 0
- if `decode' {
= if 0 {
tempvar dcdd
capture decode `1', gen(`dcdd') `maxleng'
if _rc == 0 {
replace `dcdd' = string(`1'`format') if `dcdd' == ""
replace `g' = `g' + `dcdd' + `"`punct'"' `if' `in'
local decoded 1
}
capture drop `dcdd'
}
- if !`decoded' {
= if !0 {
- replace `g' = `g' + string(`1'`format') + `"`punct'"' `if' `in'
= replace __000001 = __000001 + string(panel) + `""'
- }
- }
- else {
replace `g' = `g' + `1' + `"`punct'"' `if' `in'
}
- mac shift
- }
- while "`1'" != "" {
= while "" != "" {
capture confirm string variable `1'
if _rc {
local decoded 0
if `decode' {
tempvar dcdd
capture decode `1', gen(`dcdd') `maxleng'
if _rc == 0 {
replace `dcdd' = string(`1'`format') if `dcdd' == ""
replace `g' = `g' + `dcdd' + `"`punct'"' `if' `in'
local decoded 1
}
capture drop `dcdd'
}
if !`decoded' {
replace `g' = `g' + string(`1'`format') + `"`punct'"' `if' `in'
}
}
else {
replace `g' = `g' + `1' + `"`punct'"' `if' `in'
}
mac shift
}
- replace `g' = trim(substr(`g',1,length(`g') - `plen'))
= replace __000001 = trim(substr(__000001,1,length(__000001) - 0))
- }
- local gtype : type `g'
= local gtype : type __000001
- if "`gtype'" == "str`strlen'" {
= if "str9" == "str244" {
di in gr "(note: str`strlen' variable created; truncated values possibl
> e)"
}
-------------------------------------------------------- end _gconcat ---
- global EGEN_Varname
- if _rc { exit _rc }
- quietly count if missing(`dummy')
= quietly count if missing(__000001)
- if r(N) {
local s = cond(r(N)>1,"s","")
di in bl "(" r(N) " missing value`s' generated)"
}
- rename `dummy' `name'
= rename __000001 psu
-------------------------------------------------------------- end egen ---

. svyset [pw=panelwt], psu(psu)
---------------------------------------------------------- begin svyset ---
- version 8
- if _caller() < 8 {
- svyset_7 `0'
= svyset_7 [pw=panelwt], psu(psu)
------------------------------------------------------ begin svyset_7 ---
- version 6
- local keylist "pweight strata psu fpc"
- tokenize "`0'", parse(" ,")
= tokenize "[pw=panelwt], psu(psu)", parse(" ,")
- if "`1'"=="" | ("`1'"=="," & "`2'"=="") {
= if "[pw=panelwt]"=="" | ("[pw=panelwt]"=="," & ","=="") {
disp_key `keylist'
exit
}
- if "`1'"=="," {
= if "[pw=panelwt]"=="," {
if "`2'"=="clear" & "`3'"=="" {
clr_key `keylist'
exit
}
error 198
}
- local key "`1'"
= local key "[pw=panelwt]"
- macro shift
- chk_key `key' `keylist'
= chk_key [pw=panelwt] pweight strata psu fpc
-------------------------------------------- begin svyset_7.chk_key ---
- args key
- local i 2
- while "``i''"!="" {
= while "pweight"!="" {
- if "`key'"=="``i''" {
= if "[pw=panelwt]"=="pweight" {
sret local WhichKey = `i' - 1
exit
}
- local i = `i' + 1
= local i = 2 + 1
- }
- while "``i''"!="" {
= while "strata"!="" {
- if "`key'"=="``i''" {
= if "[pw=panelwt]"=="strata" {
sret local WhichKey = `i' - 1
exit
}
- local i = `i' + 1
= local i = 3 + 1
- }
- while "``i''"!="" {
= while "psu"!="" {
- if "`key'"=="``i''" {
= if "[pw=panelwt]"=="psu" {
sret local WhichKey = `i' - 1
exit
}
- local i = `i' + 1
= local i = 4 + 1
- }
- while "``i''"!="" {
= while "fpc"!="" {
- if "`key'"=="``i''" {
= if "[pw=panelwt]"=="fpc" {
sret local WhichKey = `i' - 1
exit
}
- local i = `i' + 1
= local i = 5 + 1
- }
- while "``i''"!="" {
= while ""!="" {
if "`key'"=="``i''" {
sret local WhichKey = `i' - 1
exit
}
local i = `i' + 1
}
- di in red "keyword incorrect"
keyword incorrect
- error 198
invalid syntax
---------------------------------------------- end svyset_7.chk_key ---
-------------------------------------------------------- end svyset_7 ---
Clear
exit
}
------------------------------------------------------------ end svyset ---
r(198);

end of do-file
- local retcod = _rc
- display "Log file `1'.log completed on $S_DATE at $S_TIME"
= display "Log file testdolog.log completed on 5 Jan 2005 at 13:45:49"
Log file testdolog.log completed on 5 Jan 2005 at 13:45:49
- log close
log: D:\dhferry\cu_sph\churn\analysis\testdolog.log
log type: text
closed on: 5 Jan 2005, 13:45:49
-------------------------------------------------------------------------------
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index