Statalist


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

st: RE: Renaming year-quarter indicators with a local


From   "Steichen, Thomas J." <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Renaming year-quarter indicators with a local
Date   Fri, 18 Jan 2008 14:41:19 -0500

Works fine for me.
The implication of the error is that you must have had a space after
_Iquarter_ and before `qtr'.

Here's my test code:

.. clear
.. set obs 3
obs was 0, now 3

.. gen _Idate_130 = 0
.. rename _Idate_130 _Iquarter_92_2

.. local qtr: display %tqY!_q 130
.. di "`qtr'"
92_3

.. gen _Idate_131 = 0
.. rename _Idate_131 _Iquarter_`qtr'

.. desc

Contains data
  obs:             3
 vars:             2
 size:            36 (99.9% of memory free)
-------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------
_Iquarter_92_2  float  %9.0g
_Iquarter_92_3  float  %9.0g
-------------------------------------------------------------------------------
Sorted by:

..


-----------------------------------
Thomas J. Steichen
[email protected]
-----------------------------------

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Davide Cantoni
Sent: Friday, January 18, 2008 2:03 PM
To: [email protected]
Subject: st: Renaming year-quarter indicators with a local

I'm trying to rename indicator variables for a time period that have
been created with xi. What I cannot understand is why

.. rename _Idate_130 _Iquarter_92_3

works perfectly, whereas the following code does not

.. local qtr: display %tqY!_q 130

.. rename _Idate_130 _Iquarter_`qtr'
92_3 not allowed

Thanks for your suggestions,

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

-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney-client or other legal privileges, and/or
proprietary non-public information. If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system. Use, dissemination, distribution,
or reproduction of this message and/or any of its attachments (if
any) by unintended recipients is not authorized and may be
unlawful.   

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