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]

st: passing indefinite no of arguments


From   tashi lama <ltashi32@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: passing indefinite no of arguments
Date   Fri, 30 Mar 2012 18:43:16 +0000

Hello all,  

     Could someone give me an idea or give me a lead on this problem.        

So, say I have a do file which will add the arguments and display 

*sum

args a b c d

di `a' +`b'+`c'+`d' 



This one is easy since I could pass 4 arguments a, b, c and d and my do file will sum them. What if I don't know the no of arguments I am passing? I could have passed 2, 3, 5 or even 1 and find their sum. 

How would you pass the arguments and code? Any help will be highly appreciated... 



Thanks, 

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