Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65064

is there a command that returns maximum and minimum length of a string variable?

$
0
0
I'm looking for a Stata command that stores the maximum and minimum length of a string variable - as a shortcut to the long way, which would go by:
gen vnew = strlen(v1)
egen smax = max(vnew)
etc.

I want to write syntax that looks like

local smax = r(maxlength)
local smin = r(minlength)

I need these locals as an indicator for correct / incorrect string variables as part of a testing routine of a host of files .

My research of such a command had no result - does someone out there know better?


Viewing all articles
Browse latest Browse all 65064

Trending Articles