zaizaibob 发表于 2013-8-17 10:22 
还想请问您,quietly by stkcd year: gen dup = cond(_N==1,0,_n) 这个命令的具体含义,您能抽空解释一下 ...
cond函数作用:
cond(x,a,b,c) or cond(x,a,b)
Domain x: -8e+307 to 8e+307 and missing; 0 means false, otherwise interpreted as true
Domain a: numbers and strings
Domain b: numbers if a is a number; strings if a is a string
Domain c: numbers if a is a number; strings if a is a string
Range: a, b, and c
Description: returns a if x is true and nonmissing, b if x is false, and c if x is missing.
returns a if c is not specified and x evaluates to missing.
Note that expressions such as x>2 will never evaluate to missing.
cond(x>2,50,70) returns 50 if x > 2 (includes x > .)
cond(x>2,50,70) returns 70 if x < 2
quietly是为了不输出结果在屏幕上。