Statalist


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

Re: st: Rearranging Variables


From   "Friedrich Huebler" <fhuebler@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Rearranging Variables
Date   Sat, 2 Feb 2008 14:29:35 -0500

Alekos,

It would be helpful if you could explain why your commands do not
work. One problem with your code is that "if month`x' = 1" should be
"if month`x' == 1".

Friedrich

On Feb 1, 2008 3:49 PM, Alekos Bibudis
<alekos.bibudis@phil.tu-chemnitz.de> wrote:
> Hi everyone.
>
> Using data from the GSOEP I`d like to transform some variables handling
> with information on occupational status.
> There is a variable for each wave and month of the year holding 0/1
> coded information wether the person was unemployed at this point in time
> or not (84 variables from Jan99 to Dez05).
> I additionally have information on the month and year the interview was
> conducted. That is for each wave a variable coded 1 (Jan) to 12 (Dec) (7
> variables from month00 to month06).
>
> What I'd like to arrange is to generate twelve new variables holding the
> information of unemployment status of the twelve months BEFORE the
> interview was conducted (Monat1 to Monat12) starting with Interviewmonth
> Jan00 and ending with Jan06.
>
> The logic would be:
> generate a new yariable and give it the value of the month before the
> interview
> generate another new variable and give it the value of two months before
> the interview
> ...
> generate a last variable and give it the value of twelve months befor
> the interview
>
> For 2006 there is no information on unemployment status, because it will
> be gathered retrospectivively in the next wave.
>
> Here's what I've tried, I know it doesn't work, but maybe it'll help to
> see what I'm after:
>
> #d;
> version 9.1;
> local y = 1999;
> foreach x in 00 01 02 03 04 05 06{;
> gen Monat1 = Dez`y' if month`x' = 1;
> local y = `y' + 1;
> };
>
> I'd appreciate every help I can get on this.
>
> --
> ___________________________
> Dipl.-Soz. Alekos Bibudis
> "Betrieb und Beschäftigung im Wandel"
> SFB 580, Projekt B2
> Friedrich-Schiller-Universität Jena
>
> Phone: +49-(0)371-6957616
> Website: http://www.sfb580.uni-jena.de

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index