Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Problems with:"drawnorm "$varlist"_1, mean(b1) cov(V1)


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Problems with:"drawnorm "$varlist"_1, mean(b1) cov(V1)
Date   Thu, 9 Sep 2010 15:11:13 +0000 (GMT)

--- On Thu, 9/9/10, Daniele Pacifico wrote:
> In other words, I would like to create 3x5 new variables
> using the same name of the tree main variables (x,y,z)
> but adding  _`c'  at the end of each of them I need to
> find a way that allows me to change automatically the
> number and the name of the variables in varlist.

Here is one way:

*---------------- begin example ------------------
local varl "x y y"

local varl : list retokenize varl
local varl : subinstr local varl " " "_c ", all
local varl "`varl'_c"

di "`varl'"
*----------------- end example ------------------

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------


      

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