Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Basic Commands

From   "Jun Xu" <>
Subject   st: Re: Basic Commands
Date   Wed, 05 May 2004 14:29:00 -0500

Just to corrent my awkward syntax here:

set obs 200 // if obs <200
local var1lbl "all the vavalues of country"
local var2lbl "all the values of year"
gen country=.
gen year=.
gen cntvar3=.

local i = 1
foreach var1val in `var1lbl' {
foreach var2val in `var2lbl' {
replace country = `var1val' if _n =`i'
replace year = `var2val' if _n=`i'
count var3
replace cntvar3 = r(N) if _n=`i'
local ++i

keep if _n<=200
keep country year cntvar3
save whereever


MSN Toolbar provides one-click access to Hotmail from any Web page FREE download!

* For searches and help try:

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