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: Problems with:"drawnorm "$varlist"_1, mean(b1) cov(V1)


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index