Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Replace missing values for pairs of variables


From   "Hugh Colaco" <[email protected]>
To   statalist <[email protected]>
Subject   st: Replace missing values for pairs of variables
Date   Wed, 10 May 2006 11:09:08 -0400

Hi,

I have pairs of variables (i.e. p1 q1, p2 q2, etc. The final pair is
pfinal and qfinal). All I want is that when either p`i' or q`i' has a
blank, it takes the value of 0 while the other retains its value. When
both p and q are blank, I dont want anything to be changed. See
example below.

Thanks,

Hugh



What I have now:-

Obs #	p1	q1	p2	q2	pfinal	qfinal
1	5	1		1	3	
2	7					5
3			8		1	
4		3	9		9	
						
						
						
What I want:-						
						
Obs #	p1	q1	p2	q2	pfinal	qfinal
1	5	1	0	1	3	0
2	7	0			0	5
3			8	0	1	0
4	0	3	9	0	9	0

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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