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]

st: Expanding characteristics of variables with 32-character names


From   Matthew White <[email protected]>
To   [email protected]
Subject   st: Expanding characteristics of variables with 32-character names
Date   Mon, 5 Aug 2013 17:14:23 -0400

Hi Statalist users,

Using Stata 13 on Windows 7, I'm attaching a characteristic to
variables and then using single quotes to expand the characteristic.
For example:

sysuse auto, clear
char foreign[Y] 1
char list foreign[]
display `foreign[Y]'

However, I'm having trouble when the variable name is 32 characters long:

sysuse auto, clear

char foreign[Y] 1
char list foreign[]
display `foreign[Y]'

local var : di _dup(32) "x"
rename foreign `var'

char list `var'[]
display ``var'[Y]'

`var'[Y] still exists, but ``var'[Y]' doesn't expand to anything. Has
anyone seen this problem before?

I can get around it by using the -:char- extended macro function:

display `:char `var'[Y]'

This correctly displays 1. However, I'd prefer to use the ``var'[Y]'
syntax if possible.

Thank you,
Matt

-- 
Matthew White
Senior Project Associate
Innovations for Poverty Action
101 Whitney Avenue, New Haven, CT 06510 USA
www.poverty-action.org
*
*   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