Statalist The Stata Listserver


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

st: Accessing the value of the sort variable in a byable program


From   "Jackson, Catherine A." <cajackson@ShastaCollege.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Accessing the value of the sort variable in a byable program
Date   Wed, 15 Nov 2006 16:24:08 -0800

I'm working on a program that will generate a series of tables for
various academic departments.  I want each department's tables to be
together so I've written a fairly generalizable "byable" program as
follows:

>program define neat, byable(recall) 
>      version 9.2
>    
>      marksample touse 
>
>      display "Total enrollment"
>      tab newterm if `touse'
>
>      display "Total enrollment by credit status"
>      tab regcred if `touse'
>    
>      end
>
>sort subject
>by subject: neat

I'd like to enhance the output by displaying the current subject_value
in the title of each table (the current subject_value is printed at the
top of each series of tables automatically).  I've tried a variety of
statements including:  
>display subject "  subject"
>display `_byvars' "  _byvars" 
However, I always get the first subject_value, rather than the current
subject_value as indicated by the -> automatic heading.  

Does anyone know how I can capture the current subject value and print
it out as part of the program?  

Any suggestions would be greatly appreciated!
Thanks.
Catherine


Catherine A. Jackson, Ph.D.
Director of Research and Planning
Shasta College
Redding, CA
(530) 242-7679

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index