Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Parsing issue?


From   "E. Paul Wileyto" <[email protected]>
To   [email protected]
Subject   st: Parsing issue?
Date   Fri, 25 Apr 2008 12:31:45 -0400

I cannot fathom what is going on here, and I'm hoping someone out there might have a clue. The twoway command correctly interprets the local macro `x' and puts up the graph. The graph save command does not seem to know the meaning of `x', and lops off the backslash in front of it. Any thoughts. I'm appending the main output, and then a trace... I'm not seeing anything useful in the trace.

. ma list varroot
varroot: bold_acc_l bold_dlpfc9_l bold_dlpfc46_l bold_dlpfc46_r bold_ifg_l
bold_ifg_r bold_ipc_l bold_ipc_r bold_mfg_r fnb3_cr fnb3_fp fnb3_ft
fnb3_nr fnb3_rt fnb3_eff lnb3_eff lnb3_fp lnb3_rtc lnb3_tp

. do "C:\DOCUME~1\epw.MED\LOCALS~1\Temp\STD0e000000.tmp"

. foreach x of global varroot {
2. twoway (line `x'_aa_a backlev) (line `x'_aa_s backlev) (line `x'_ag_a back
> lev) (line `x'_ag_s backlev) (line `x'_gg_a backlev) (line `x'_gg_s backlev)
3. graph save Graph "V:\fMRI_COMT\Data\WebCNP\`x'_graph.gph"
4.
. global gnames "$gnames V:\fMRI_COMT\Data\WebCNP\`x'_graph.gph"
5.
. }
file V:\fMRI_COMT\Data\WebCNP_graph.gph already exists
r(602);

And now for the trace:

- graph save Graph V:\fMRI_COMT\Data\WebCNP\`x'_graph.gph
= graph save Graph V:\fMRI_COMT\Data\WebCNP`x'_graph.gph
----------------------------------------------------------------- begin graph ---
- if (_caller() < 8.2) version 8
- else if (_caller() < 10 ) version 8.2
- else version 10
- gdi record = yes
- gdi maybedraw = yes
- capture noisily Graph `0'
= capture noisily Graph save Graph V:\fMRI_COMT\Data\WebCNP_graph.gph
--------------------------------------------------------- begin graph.Graph ---
- if d(`=c(born_date)') < d(23Jul2004) {
= if d(25 Jul 2007) < d(23Jul2004) {
di as err "your Stata executable is out of date"
di as err " type -update executable- at the Stata prompt"
exit 498
}
- if "`._Gr_Global.isa'" == "" {
= if "class" == "" {
._Gr_Global = .global_g.new
}
- if `"`0'"' == `""' {
= if `"save Graph V:\fMRI_COMT\Data\WebCNP_graph.gph"' == `""' {
if `"`.__GRAPHCMD'"' != `""' {
local 0 `.__GRAPHCMD'
}
else {
di as error "no existing graph command to replay"
exit 198
}
}
- local orig_cmd `0'
= local orig_cmd save Graph V:\fMRI_COMT\Data\WebCNP_graph.gph
- gettoken do 0 : 0, parse(" ,")
- local orig2 `"`0'"'
= local orig2 `" Graph V:\fMRI_COMT\Data\WebCNP_graph.gph"'
- local ldo = length("`do'")
= local ldo = length("save")
- if "`do'" == substr("draw",1,max(4,`ldo')) {
= if "save" == substr("draw",1,max(4,4)) {
gr_draw_replay `0'
exit
}
- if "`do'" == substr("display",1,max(2,`ldo')) {
= if "save" == substr("display",1,max(2,4)) {
gr_draw_replay `0'
exit
}
- if "`do'" == substr("save",1,max(4,`ldo')) {
= if "save" == substr("save",1,max(4,4)) {
- gr_save `0'
= gr_save Graph V:\fMRI_COMT\Data\WebCNP_graph.gph
=string scalar __pathmkabsolute(string scalar path)
= string scalar curdir, toret
=string scalar __filemkabsolute(string scalar file)
= string scalar curdir, fname, toret
----------------------------------------------------------- begin gr_save ---
- version 10
- syntax anything [, REPLACE ASIS ]
- gettoken name anything : anything
- gettoken filenm nothing : anything
- if `"`filenm'"' == `""' {
= if `"V:\fMRI_COMT\Data\WebCNP_graph.gph"' == `""' {
local filenm `"`name'"'
local name
}
- if `"`filenm'"' == `""' {
= if `"V:\fMRI_COMT\Data\WebCNP_graph.gph"' == `""' {
di as error `"filename name required"'
exit 198
}
- if `"`nothing'"' != `""' {
= if `""' != `""' {
di as error `"invalid syntax, `nothing' not allowed"'
exit 198
}
- if "`name'" == "" {
= if "Graph" == "" {
local name `._Gr_Global.current_graph_resync'
}
- if "`asis'" != "" | "`name'" == "" {
= if "" != "" | "Graph" == "" {
if "`name'" != "" & "`name'" != "`._Gr_Global.current_graph_resync'" {
gr_current name : `name' , drawifchg
}
_asis save `"`filenm'"' , `replace'
exit
}
- _addgph filenm : `"`filenm'"'
= _addgph filenm : `"V:\fMRI_COMT\Data\WebCNP_graph.gph"'
--------------------------------------------------------- begin _addgph ---
- version 8
- gettoken macnm 0 : 0 , parse(" :")
- gettoken colon 0 : 0 , parse(" :")
- gettoken filenm 0 : 0 , parse(" :")
- local filenm `filenm'
= local filenm V:\fMRI_COMT\Data\WebCNP_graph.gph
- local unused : subinstr local filenm "." "." , count(local ct)
- if (! `ct') local gph .gph
= if (! 1) local gph .gph
- c_local `macnm' `"`filenm'`gph'"'
= c_local filenm `"V:\fMRI_COMT\Data\WebCNP_graph.gph"'
----------------------------------------------------------- end _addgph ---
- gr_current name : `name' , drawifchg
= gr_current name : Graph , drawifchg
------------------------------------------------------ begin gr_current ---
- version 8
- gettoken namemac 0 : 0, parse(" :")
- gettoken colon 0 : 0, parse(" :")
- assert "`colon'"==":"
= assert ":"==":"
- syntax [anything(name=name)] [ , DRAWifchg Newgraph Query REPLACE NOFREE
> ]
- gettoken prefix rest : name , parse(".")
- if "`prefix'" == "Global" | "`prefix'" == "Local" {
= if "Graph" == "Global" | "Graph" == "Local" {
gettoken dot name : rest , parse(".")
}
- if "`._Gr_Global.isa'" == "" {
= if "class" == "" {
._Gr_Global = .global_g.new
}
- if "`query'"!="" {
= if ""!="" {
if "`name'" == "" {
local name `._Gr_Global.current_graph_resync'
}
gs_stat exists `name'
c_local `namemac' `name'
exit
}
- if "`newgraph'" == "" {
= if "" == "" {
- OldGraph realname : `name' , `drawifchg'
= OldGraph realname : Graph , drawifchg
------------------------------------------- begin gr_current.OldGraph ---
- gettoken namemac 0 : 0, parse(": ")
- gettoken colon 0 : 0, parse(": ")
- syntax [name(name=name)] [ , DRAWifchg Newgraph REPLACE ]
- if "`name'"=="" {
= if "Graph"=="" {
local name = cond("`._Gr_Global.current_graph_resync'"=="", "Graph", "`
> ._Gr_Global.current_graph_resync'")
}
- gs_stat exists `name'
= gs_stat exists Graph
----------------------------------------------------- begin gs_stat ---
- if "`2'" != ":" {
= if "Graph" != ":" {
- Assert `0'
= Assert exists Graph
-------------------------------------------- begin gs_stat.Assert ---
- args status name nothing
- if "`nothing'"!="" {
= if ""!="" {
di as error "`name' `nothing' invalid name"
exit 198
}
- assert "`status'"=="exists" | "`status'"=="!exists"
= assert "exists"=="exists" | "exists"=="!exists"
- Stat type : `name'
= Stat type : Graph
-------------------------------------------- begin gs_stat.Stat ---
- args lhs colon name
- capture noi confirm name `name'
= capture noi confirm name Graph
- if (_rc) exit 198
- if "`.`name'.isa'" == "" c_local `lhs' ""
= if "class" == "" c_local type ""
- else {
- if 0`.`name'.isofclass graph_g' c_local `lhs' "graph"
= if 01 c_local type "graph"
- else if 0`.`name'.isofclass lgrid' c_local `lhs' "graph"
= else if 00 c_local type "graph"
- else c_local `lhs' "other"
= else c_local type "other"
- }
---------------------------------------------- end gs_stat.Stat ---
- if ("`type'"=="graph" & "`status'"== "exists") | ("`type'"=="" & "`
> status'"=="!exists") exit
= if ("graph"=="graph" & "exists"== "exists") | ("graph"=="" & "exist
> s"=="!exists") exit
---------------------------------------------- end gs_stat.Assert ---
- }
- else {
args lhs colon name
Query me `colon' `name'
c_local `lhs' = cond("`me'"=="graph", "exists", "!exists")
}
------------------------------------------------------- end gs_stat ---
- capture window manage forward graph `name'
= capture window manage forward graph Graph
- if "`name'" != "`._Gr_Global.current_graph_resync'" & "`drawifchg'" !=
> "" {
------------------------------- begin global_g.current_graph_resync ---
- version 8
- if ("`gdi(topwindow)'" == "__BLANK") class exit ""
= if ("Graph" == "__BLANK") class exit ""
- else if ("`gdi(topwindow)'" == "") class exit "`.current_graph'"
= else if ("Graph" == "") class exit "Graph"
- else {
- .current_graph = "`gdi(topwindow)'"
= .current_graph = "Graph"
- class exit "`.current_graph'"
= class exit "Graph"
--------------------------------- end global_g.current_graph_resync ---
= if "Graph" != "Graph" & "drawifchg" != "" {
._Gr_Global.set_current_graph "`name'"
.`name'.drawgraph
}
- ._Gr_Global.set_current_graph "`name'"
= ._Gr_Global.set_current_graph "Graph"
---------------------------------- begin global_g.set_current_graph ---
- version 8
- args graph
- .current_graph = "`graph'"
= .current_graph = "Graph"
------------------------------------ end global_g.set_current_graph ---
- if "`.`name'._scheme.isa'" != "" {
= if "class" != "" {
- set curscm `.`name'._scheme.objkey'
= set curscm __key(403aa90)
- }
- c_local `namemac' `name'
= c_local realname Graph
--------------------------------------------- end gr_current.OldGraph ---
- c_local `namemac' `realname'
= c_local name Graph
- exit
-------------------------------------------------------- end gr_current ---
- capture noisily {
- tempname loghndl holdmap
- global T_loghndl `loghndl'
= global T_loghndl __000000
- file open `loghndl' using `"`filenm'"' , text write `replace'
= file open __000000 using `"V:\fMRI_COMT\Data\WebCNP_graph.gph"' , text writ
> e
file V:\fMRI_COMT\Data\WebCNP_graph.gph already exists
.__Map = .null.new
global T_savesers 1
_gs_wrfilehdr `loghndl' `name'
foreach type in serset scheme graph_g lgrid {
.`name'.saveall `type' 1
}
file close `loghndl'
}
- local rc = _rc
- capture _cls free __Map
- capture mac drop T_loghndl
- capture mac drop T_savesers
- if `rc' {
= if 602 {
- exit `rc'
= exit 602
}
------------------------------------------------------------- end gr_save ---
exit
}
----------------------------------------------------------- end graph.Graph ---
- local rc = _rc
- gdi record = yes
- gdi maybedraw = yes
- gdi end
- exit `rc'
= exit 602
------------------------------------------------------------------- end graph ---
global gnames "$gnames V:\fMRI_COMT\Data\WebCNP\`x'_graph.gph"
}
r(602);







--
E. Paul Wileyto, Ph.D.
Assistant Professor of Biostatistics
Tobacco Use Research Center
School of Medicine, U. of Pennsylvania
3535 Market Street, Suite 4100
Philadelphia, PA 19104-3309

215-746-7147
Fax: 215-746-7140
[email protected]
http://mail.med.upenn.edu/~epw/
*
* 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