Michael, it is not clear for novice programmers like me to detect where
word-wrapping is a problem. If you have time, perhaps you could change
the delimiter to something like ';'. Alternatively, I"ve cleaned it up
as best as I can figure out but I'm puzzled by the section I've marked
with ***?***. Are the <CR> correct?
program define tabvals
version 8.0
*! v 1.0 M Blasnik
*** ? ***
syntax varlist( min=1 max=2) [if] [in], values(numlist)
[MISSing] * if "`missing'"!="" { local novarlist "novarlist"
}
*** ? ***
marksample touse , `novarlist'
local var: word 1 of `varlist'
qui levels `var' if `touse', local(hasvals) `missing'
local addvals: list values - hasvals
local tempobs: word count `addvals'
if `tempobs'>0 {
preserve
local origN=_N
qui expand `tempobs'+1 in l
tempvar real
qui gen byte `real'=(_n<=`origN')
qui replace `touse'=1 in -`tempobs'/l
forvalues i=1/`tempobs' {
local obsn=`origN'+`i'
local val: word `i' of `addvals'
qui replace `var'=`val' in `obsn'
}
noi tab `varlist' if `touse', subpop(`real') `missing' `options'
restore
}
else {
noi tab `varlist' if `touse' , `missing' `options'
}
end
John LeBlanc
__________________________________________________________
John C. LeBlanc, MD, MSc, FRCPC
Associate Professor
Pediatrics, Psychiatry, Community Health and Epidemiology
Dalhousie University
IWK Health Centre Work phone: (902) 470-8930
5850 University Avenue Work fax: (902) 470-6913
Halifax, Nova Scotia Email: [email protected]
B3K 6R8 CANADA Pager: (902) 470-8888
__________________________________________________________
On Sat, 12 May 2007 12:58:46 -0400, Michael Blasnik wrote:
I just posted it on Statalist in this thread -- that's the only way to
get it
now. I have not made it available any other way since I thought
that -tabvalues- accomplished the same thing. I guess there are some
differences, so I might post it to SSC if I get around to writing a help
file.
In the mean time, just use the Statalist archives to retrieve my message
and fix
any word wrap problems and save it to your local ado folder.
Michael Blasnik
----- Original Message -----
From: "Michael McCulloch" <[email protected]>
To: <[email protected]>
Sent: Saturday, May 12, 2007 12:15 PM
Subject: st: interested in tabvals
Hello Statalist members,
This -tabvals- program looks useful. I have searched the Stata site
and the
web without success. Is this a program that can be obtained for use?
Thank you.
*
* 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/
*
* 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/