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

From |
n j cox <n.j.cox@durham.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Programming question. |

Date |
Thu, 18 Aug 2005 17:27:35 +0100 |

In addition to Tom Steichen's excellent suggestion,

another possibility is

local wants_pca = inlist("`method'", "pca")

local wants_fac = inlist("`method'", "factor")

local wants_mca = inlist("`method'", "mca")

if (`wants_pca' + `wants_fac' + `wants_mca') == 0 {

di as err "need at least one of factor pca mca"

exit 198

}

Later you can go

if `wants_pca' {

...

}

and so forth.

Nick

n.j.cox@durham.ac.uk

>>> Amadou Bassirou DIALLO.

I am writing an ado and face a problem in parsing

an option.

I want to add to my syntax an option (method)

which could be mca factor or pca.

The user could specify all the three or only one,

but must specify at least one.

But somehow, I can't figure how to parse that option.

So my code is :

syntax varlist [if] [in] [weight], Method(string)

...

tokenize `method'

/*Here, the only I though of is to parse method and pass arguments one by one*/

if "$_1" == "factor" {

I run factor analysis

}

if "$_2" == "pca" {

pca

}

etc...

end

By I want the user to be able to specify all the methods he wants.

Also, I realized that if factor is not put in premiere instance, no method is used.

*

* 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/

- Prev by Date:
**st: How to test the goodness of fit after GLM** - Next by Date:
**Re: st: I'm making bar charts - can I add vertical CI markers ontop of the bars?** - Previous by thread:
**st: Programming question.** - Next by thread:
**RE: st: Programming question.** - Index(es):

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