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: populating a local macro with a stringvariable

From   Daniel Pilsgaard Henriksen <>
Subject   st: populating a local macro with a stringvariable
Date   Mon, 19 Dec 2011 13:33:40 +0100

Dear Statalist

I'm new to using macros in stata, and I'm having trouble populating
local macro with a variable containing strings sorted by their length
instead of their order of apperence. Here's an example of my problem

inp str30 alt

gen len = length(alt)
sort length
levelsof alt, loc(i)
di `"`i'"'

I'm sure there're a easy way of doing this, but I've tried for some
time now and it's not showing up.

Daniel Henriksen
Ph.d. studerende, læge
Infektionsmedicinsk afd Q / Akut Modtage Afdelingen
Odense Universitetshospital

*   For searches and help try:

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