Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: a, perhaps, not so really silly question


From   Scott Talkington <[email protected]>
To   [email protected]
Subject   Re: st: a, perhaps, not so really silly question
Date   Tue, 08 Mar 2011 22:46:32 -0500

On 3/8/2011 2:28 PM, Eric Booth wrote:
If you don't want every possible combination, but only specified pairs, you can use something like this:

loc vars   DroppedOut drop     RepeatedGrade rgrade     Whatever  otherstuff
token `"`vars'"'
while `"`1'"' != "" {
	di "`1' and `2'"
tabxml, dv(`2') ivd(rchurch) options(n) split(mono) osvy save( C:\data\NLSY Children of 79\Deliverables/`1'IN)
tabxml, dv(`2') ivd(rchaste) options(n) split(mono) osvy save( C:\data\NLSY Children of 79\Deliverables/`1'IIN)
tabxml, dv(`2') ivd(rchurch) options(per) tf(2) split(mono) percent(row) osvy save( C:\data\NLSY Children of 79\Deliverables/`1'IP)
tabxml, dv(`2') ivd(rchaste) options(per) tf(2) split(mono) percent(row) osvy save( C:\data\NLSY Children of 79\Deliverables/`1'IIP)
......etc......
		macro shift 2
	}
Thanks, that's pretty much what I wanted. Thanks to Nick's article I even understand (mostly) why it works. What I have to get used to is the somewhat idiosyncratic use of the word "macro" in Stata programming, and a bit more about the precise syntax for the "while" command. I could also probably define a few more macros so that it's only necessary to have one version of the command line.

--Scott
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index