| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: RE: Accessing the value of the sort variable in a byable program -- Thanks Scott
From |
"Jackson, Catherine A." <[email protected]> |
To |
<[email protected]> |
Subject |
st: RE: RE: Accessing the value of the sort variable in a byable program -- Thanks Scott |
Date |
Fri, 17 Nov 2006 11:34:15 -0800 |
Thanks Scott for your help. I needed to add some double quotes around
the `1' but it works great. AND it is much easier to use than writing a
byable program.
Catherine
Catherine A. Jackson, Ph.D.
Director of Research and Planning
Shasta College
Redding, CA
(530) 242-7679
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Scott
Merryman
Sent: Wednesday, November 15, 2006 5:25 PM
To: [email protected]
Subject: st: RE: Accessing the value of the sort variable in a byable
program
Would it be easier to use -levelsof- and -foreach-?
Something like this:
levelsof subject, local(levels)
foreach l of local levels {
disp "Total Enrollment of subject `l'"
tab newterm if subject == `l'
disp " "
disp "Total Enrollment by Credit Status for subject `l'"
tab regcred if subject == `l'
}
Scott
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Jackson, Catherine A.
> Sent: Wednesday, November 15, 2006 6:24 PM
> To: [email protected]
> Cc: Jackson, Catherine A.
> Subject: st: Accessing the value of the sort variable in a byable
program
>
> 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
*
* 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/