Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: SMCL {stata args[:txt]}


From   Eric Booth <ebooth@ppri.tamu.edu>
To   "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: SMCL {stata args[:txt]}
Date   Wed, 1 Jun 2011 20:48:53 +0000

<>

I'm a bit fuzzy on what your question is exactly -- but I think you want to define something to do to `vn' in your program -smcprog-...if so you can do something like:

************!
cap prog drop myprog
cap prog drop smcprog
prog def smcprog
syntax anything
***list and summarize mpg/rep78 for `vn'***
li mpg rep78  if make=="`anything'"
su mpg rep78 if make=="`anything'"
end


prog def myprog
gettoken first 0:0
loc k `first'
forvalues n=1/`k'{
loc vn=make[`n']
dis _col(10)"{stata smcprog `vn':`vn'}"
}
end

**example**
sysuse auto, clear
myprog  10
****************!

- Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754
On Jun 1, 2011, at 3:26 PM, K D Nash wrote:

> I have a stata program that lists identification (ID) numbers for individuals as output such as:
> 
> .list guys
> 
>    30382960
>   112339480
>   134302176
>   138380064
>   138405264
>   140426064
>   142468640
>   148400608
>   163325504
>   181440336
>   186361696
> 
> The user of this program wants to be able to click on an ID number which will then provide further information about the individual selected.  The following is part of my program statements:
> 
> .......
> forvalues n=1/`k'{
> loc vn=guys[`n']
> dis _col(10)"{stata smcprog:`vn'}"
> }
> .......
> 
> where `k' is a count of the number ID numbers listed and guys[`n'] is the ID of a guy in the dataset.  This SMCL statement solves the problem of turning the list of ID numbers into "clickable links".
> 
> The problem I am having is the following.  How do I get the program, smcprog.ado, to recognize 30382960 as the ID number that is clicked?  When the user clicks an ID, I want the program smcprog.ado to go get a stata dataset that includes many ID numbers but then use only the data for the ID that was clicked to carry out other tasks.
> 
> Or, is there a better way to accomplish what I want to do.  The listing of the ID output has to be clickable links 
> *
> *   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/




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