Statalist The Stata Listserver

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

st: Writing in SMCL - two issues, compound double quotes and number formats

From   "David Elliott" <[email protected]>
To   [email protected]
Subject   st: Writing in SMCL - two issues, compound double quotes and number formats
Date   Fri, 29 Sep 2006 16:45:11 -0300

I have been converting some routines I have written to SMCL and have
run into a couple of issues.

for example the line:
       di in gr _n(2) "Category: " in ye "`ititle'" "  (" `"`if'"' ")"_n
and what one would hope could be its replacement
       di _n(2) "{txt:Category:} {res:`ititle'  ( `"`if'"' )}" _n

However, one cannot use compound double quotes, it terminates the
display at the first `"' and causes an error, but without them any
value of `if' that contains quotes will. cause an error.  One can
       di _n(2) "{txt:Category:} {res:`ititle'} (" `"`if'"' ")" _n
and everything is fine.  I would have thought that one *should* be
able to put any valid display syntax within a {txt: } or {res: }
construct but this does not appear to be the case.

The other issue is not being able to apply numeric formats in the
display command itself:
       di in ye _continue %4.0f `nc' "-" %3.0f `cp' in gr "|"
does not translate to:
       di _cont  %4.0f "{res:`nc'}-" %3.0f "{res:`cp'}" "{txt:{c |}}"
and I have tried experimenting with various permutations without
success.  I could, of course, apply the formats in a prior command,
but am curious if the formats can be applied inline as they can be in
non-smcl output.

I've done searching for smcl "numeric format" and similar searches
without turning up anything useful.  I've also examined a number of
the (BASE) adofiles to see how they have been written to give smcl
output without getting much insight.

Can anyone provide illumination as to how one can use compound double
quotes and formats within a line of smcl { }

Many thanks.

David Elliott
*   For searches and help try:

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