Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Combining two variables


From   "Michael S. Hanson" <mshanson@mac.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Combining two variables
Date   Wed, 13 Oct 2004 10:17:08 -0400

(assuming I understand correctly what "y" and "q" are):

		gen date = yq(y,q)
		format date %tq

On Oct 13, 2004, at 10:03 AM, Hans J. Baumgartner wrote:

This just changes the format and not the underlying value of the variable. I actually used these commands to generate the variable q and y.

Cheers

Hans



Ada Ma schrieb:


Check out the date format commands.

In the command box type:

view help dfmt



Hans J. Baumgartner wrote:

Hi:
I have one variable with quarters q (1-4) and one variable with years y (1950-2004), which I would like to combine into one single variable newvar that has the values 1999Q2 if y==2 and y==1999.

Is there any straight forward command for this?

Thanks in advance

Hans


*
*   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/

--
Hans J. Baumgartner DIW Berlin
German Institute for Economic Research
Dept. Public Economics
Königin-Luise-Str. 5; 14195 Berlin; Germany Tel.: +49/30/89789-307 Fax.: +49/30/89789-114
http://www.diw.de
http://www.hansbaumgartner.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/

*
*   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