I want to get a row total of nine variables if none is missing. Is my code correct?
egen phq_total=rowtotal(phq1 - phq9) if !missing(phq1 | phq2 | phq3 | phq4 | phq5 | phq6 | phq7 | phq8 | phq9)
egen phq_miss = rowmiss(phq?) egen phq_total = rowtotal(phq?) if phq_miss == 0
gen wanted = phq1 + phq2 + phq3 + phq4 + phq5 + phq6 + phq7 + phq8 + phq9
Comment