# st: RE: How to combine 2 variables with same outcome (yes, no) into 2 values in a new variable

 From "Nick Cox" To Subject st: RE: How to combine 2 variables with same outcome (yes, no) into 2 values in a new variable Date Sun, 25 Jun 2006 19:47:01 +0100

```First off, let me repeat some basic points
stressed many times on this list.

The language we are discussing is called Stata.
Getting the spelling right may not matter to
you but it irritates some of the people who
increases the probability of your postings
being zapped by experts.

You have Stata 8.0. As has already been mentioned,
you should -update- to Stata 8.2.

Now on the question:
your data in memory in Stata actually are. Two extreme
hypotheses seem consistent with your description
here, that you have not yet entered the
data, and that you have 2 variables and 115
observations in memory.

Either way, commands you should find useful,
at least in future, are -expand- and -reshape-.

Nick
n.j.cox@durham.ac.uk

buddyb

> I am using STATA 8.0
>
> I have asked 115 respondents two different questions:
>
> Q1. Rate the importance of your health: Not important,
> Somewhat Important, Very Important
>
> Q2.  Rate the importance of your income: Not
> important, Somewhat Important, Very Important
>
> And got the following responses:
>
> 	       NotImp(N)  SomeImp(S)  VeryImp(V)
> vHealth(A)	49	      31		35
> vIncome(B)	63	      32		20
>
> Right now I only have 2 variables: vHEALTH  vIncome. I
> am trying to figure out how to generate 2 new
> variables (TYPE SCORE).  Type would have two
> values...Health Income.  Score would have 3
> values....NotImp SomeImp VeryImp.
>
> In the end I would like to do a tabulate TYPE SCORE
> (to get %).  In order for tabulate to work, I need to
> create 2 variables:  SCORE & TYPE.  Score has values
> of N S V. Type has values of A B.
>
> I would need to generate 230 responses for my two
> values as follows:
>
>                          TYPE       SCORE
>          Resp 1..49       A           N
>          Resp 50..112     B           N (63 responses)
>          Resp 113-142     A           S (31 responses)
>          Resp 143-174     B           S (32 responses)
>          Resp 175-209     A           V (35 responses)
>          Resp 210-230     B           V (20 responses)
>
> Anyone have any idea how to do this...or what I'm