This looks like the problem tackled already by
Roger Newson's -sencode- (SSC) and my -oencode-
(private domain). Last time I looked, Roger's
could do things mine couldn't do, and versa vice,
so I guess I should make mine public too.
Nick
[email protected]
Wallace, John
> Thanks for the explanation, Nick. What I was seeking to do
> isn't all that
> different from how -encode- works, but I wanted to be in
> specific control of
> the association between the numeric variable and the
> alphanumeric label. I
> believe -encode- generates its new numeric variable in
> ascending alphabetic
> order of the encoded string values. The order the string
> values had in my
> original data set was structure I needed to retain, which I
> did using the
> following:
>
> . insheet using [tab-delimited text file]
> . keep v1 descriptions
> . gen pset = _n /*to record the initial order of observations*/
> . move pset v1
> . rename v1 probesetname /*the string data comes in with the
> v1 generic
> variable name*/
> . forval e = 1 /`=_N'{ /*thanks to Fred Wolfe*/
> .local pval = probesetname[`e']
> .label define psetlab `e' "`pval'", add
> .}
> .label values pset psetlab /*the desired association*/
*
* 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/