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 on April 23, and its replacement, is already up and running.

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

st: Fwd: foreach loop for generating missing variables

From   andreas chai <>
To   statalist <>
Subject   st: Fwd: foreach loop for generating missing variables
Date   Fri, 23 Sep 2011 11:16:01 +1000

Dear Stata experts :  PLease help!

I have a series of variables "x100 ... x894" in which many of these
variables are missing. e.g. x240 does not exist

I would like to create these missing variables which contain zero for all

how do i create these missing variables ?

i have tried writing a loop

!foreach x of newlist  x100- x894{
!gen `x=92 =3D0

but keep getting an error as some these variables already exist.

thank you in advance,
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index