Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Two dichotomous variables to One Categorical


From   Muhammad Anees <[email protected]>
To   [email protected]
Subject   Re: st: Two dichotomous variables to One Categorical
Date   Fri, 12 Oct 2012 13:24:21 +0500

Hello,

You can start as a novice like me reading the help files and do
experiments with alternatives. See -help tab-, -help gen-, -help egen-
and -help recode-.

So in your case, that can be done more technically and in simple ways
but here is what I would recommend to start as a novice like me and
then follow my gurus (Nick and Maarten etc) on this list.

tab yourfirstvariablename, gen(newfirstvarcategories)

gives 1 for one category say present and 0 for absent and do the same
for the other variable like

tab yoursecondvariablename. gen(newsecondvarcategory)

gives 1 for one category say present and 0 for absent, hence we have
pairs (1,1), (1,0), (0,1) and (0,0).

then

gen newvarname=0
recode newvarname 0=1 if newfirstvarcategories==1 & newsecondvarcategory==1

I hope this gives your some sense to start more conveniently.

Anees

On Fri, Oct 12, 2012 at 1:07 PM, malay biswas <[email protected]> wrote:
> Dear All,
> Novice question.
> I am trying to transform my two dichotomus variables (Present/Absent,
> Present/Absent) into one categorical variable depending upon four
> configurations(Present Present =1, Present Absent=2, Absent Present=3,
> Absent Absent=4).
>
> Could you please help by giving me stata command for the same?
>
> Thank you for your precious time and attention.
> Regards
> Malay
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/



-- 

Best
---------------------------
Muhammad Anees
Assistant Professor/Programme Coordinator
COMSATS Institute of Information Technology
Attock 43600, Pakistan
http://www.aneconomist.com
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index