Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Tokenize macro with quotes

From   Nick Cox <>
To   "''" <>
Subject   st: RE: Tokenize macro with quotes
Date   Tue, 18 Oct 2011 18:56:08 +0100

There seem to be two very distinct issues here. 

To export labels in a string variable: Quite how you are going to do this is not clear, but starting with -labellist- (SSC) seems a very long way round. What's wrong with -decode-? 

To -tokenize- a macro: You don't say exactly what you tried and exactly what happened. Try something like this: 

. local beasts `" `"toad"' `"frog"' `"newt"' "'

. tokenize `"`beasts'"'

. mac li
_3:             newt
_2:             frog
_1:             toad

If this doesn't work for you, again we need to see exactly what you try and exactly what happened. 

However, as implied, I doubt you need this at all. 


Cook, Daniel E

I'm trying to use postfile to add a variables labels as part of a summary table. My issue is finding a way to get the labels into a string variable for export.

I'm using labellist (not a part of the normal stata distribution.

So I use labellist to return a list of the labels and this is the return output (I am working with genetics here).
r(labels) : "`"AA"' `"AG"' `"GG"'"

When I try to use tokenize then (in order to grab each label individually) it doesn't work. I believe it has to do with the presence of all the quotes.

How can I get this to work with tokenize or is there a better alternative?

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index