Statalist The Stata Listserver


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

st: beginners problem with stata ado file and syntax of varlist


From   "Steffen H. Gr�ning" <removed>
To   <[email protected]>
Subject   st: beginners problem with stata ado file and syntax of varlist
Date   Thu, 6 Apr 2006 22:02:03 +0200

Hi everybody,

this should be an easy one to solve for you, but I am new to this and
have been searching and reading a long time without finding what I need.

I wrote this little .ado file (see below).

I have countries in rows and the series in columns. what I want it to do
is to look through all my variables (which are too many to list them all
by
hand) and drop those variables which have a smaller value than the [if]
for one country (in this case country 1 on the vertical axis when
browsing).

so far this thing works quite well, but what i cant figure out:

1. could I tell it not to take on certain variables/ make an exception
for some variables? If so, how?

2. is there a way of specifying which country to look for when calling
the program? (right now i would have to change the programm if i wanted
it to look for country 2, 3, 4 etc.)

And just on a sidenote: how can i get stata to just make a list of all
available variables?

Thank you very much in advance for considering to help me.

steffen.


____________________________________________

capture program drop droppp

program define droppp

set trace on

set more off

syntax [varlist] [if]
 	tokenize `if'

 		foreach variab of varlist * {
 				if `variab'[1]<`2' drop `variab'
 				}
end

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index