Statalist The Stata Listserver

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

st: String problem

From   "Kelvin Foo" <[email protected]>
To   statalist <[email protected]>
Subject   st: String problem
Date   Sun, 3 Sep 2006 21:25:53 +0100

Dear Statalisters,

I have a macro `covars' which is a list of variables, var1 var2
var3... var19 var20
I would like to exclude the last variable, var20, from `covars' so
this is what I did:

local revcovs=reverse("`covars'")
gettoken dropped revcovs: revcovs
local covars=reverse("`revcovs'")

I'm sure there must be some way more elegant, just that I can't think
of it. Any suggestions?

Elegance aside, my variable list, if too long, would get truncated
because I assigned the macro revcovs with the "=" sign in the first
line of my above code. Is there anyway to avoid the "=' sign in that

Thanks in advance for any suggestions!

*   For searches and help try:

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