Statalist The Stata Listserver


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

st: RE: How can I call a subroutine that's defined in another ado-file?


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: How can I call a subroutine that's defined in another ado-file?
Date   Thu, 15 Jun 2006 21:51:12 +0100

The short answer is that you can and should 
just copy the subroutine to your own program. 

Nick 
n.j.cox@durham.ac.uk 

Joseph Coveney
 
> I noticed that the official Stata command -tetrachoric- has a 
> subprogram
> defined in it that I would like to use.  The subprogram is 
> -PosDef-, which I
> would like to use to perform matrix approximation after 
> -polychoric-.  How
> can I call -tetrachoric.PosDef- and feed it the polychoric correlation
> matrix?
> 
> I've called -tetrachoric- with dummy data just to get the 
> ado-file loaded
> into memory, and that worked out okay--I can see it with -program list
> tetrachoric.PosDef-.  But after running -polychoric- and 
> copying the r(R)
> into a matrix, say, R, I cannot successfuly feed that matrix
> to -tetrachoric-'s -PosDef- subroutine.
> 
> That is, something like that below fails, yet I can confirm that the
> subprogram still resides in memory.  Do I need to filch the code
> from -tetrachoric- and copy it into a stand-alone ado-file?
> 
> Joseph Coveney
> 
> [output after initial use of -tetrachoric with dummy data omitted for
> brevity]
> 
> . polychoric questionnaire_item*
> 
> . matrix R = r(R)
> 
> . local N = r(N) // for use in -factormat-
> 
> . tetrachoric.PosDef R
> unrecognized command:  tetrachoric.PosDef invalid command name
> r(199);
> 
> . PosDef R
> unrecognized command:  PosDef
> r(199);
> 
> . program list tetrachoric.PosDef
> 
> tetrachoric.PosDef, rclass:
>   1.         args R
>   2.         if !issym(`R') {
>   3.                 error 505
>   4.         }
>   [output redacted for brevity]
>  22.         }
> 
> . program list PosDef
> PosDef not found
> r(111);

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