{smcl}
{* 26 April07}{...}
{hi:help setgen}{right: ({browse "http://www.stata-journal.com/article.html?article=st0140":SJ8-1: st0140})}
{hline}

{title:Title}

{p2colset 5 15 17 2}{...}
{p2col :{hi:setgen} {hline 2}}Creating set variables{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 14 2} {cmd:setgen} {it:newvar} {cmd:=}
  {it:fcn}{cmd:(}{it:arguments}{cmd:)} [{cmd:,} {it:option}]

{pstd}
where, depending on the {it:fcn}, {it:arguments} refers to an expression,
{varlist}, or {it:{help numlist}}, and the {it:option} is also {it:fcn}
dependent, and where {it:fcn} is

{p 4 8 2}
{opt stdrank(varname)} rank orders the variable and then standardizes this
ranking to range from 0 to 1. The equation for this standardization is
(rankedvar - min(rankedvar))/(max(rankedvar) - min(rankedvar))

{p 4 8 2}
{opt drect(varname)}{cmd:,} {opt anchors(numlist)} performs the "direct"
transformation.  The {cmd:anchors()} option must be entered in ascending order
(i.e., minimum threshold, crossover point, maximum threshold). 

{p 4 8 2}
{opt ndrect(varname)}{cmd:,} {opt grpdvar(varname)} performs the "indirect"
transformation.  The {cmd:grpdvar()} option should be a categorization of the
original variable in groups according to their levels of membership (e.g., more
in than out = 0.33).  

{p 4 8 2}
{opt crisp(varname)} [{cmd:,} {opt cutpt(#)}] creates a "crisp" transformation,
creating a binary 0/1 variable. The default is to split the new variable at the
original variable's  median.  The {cmd:cutpt()} option can be used to specify
where the variable should be split, such that all those values less
than or equal to {it:#} will be coded 0 and the rest 1.


{title:Description}

{pstd}{cmd:setgen} generates "sets" from variables. Each {it:fcn} is a
different method for transforming variables to range from 0 to 1, all in line
with fuzzy-set qualitative comparative analysis methods.


{title:Examples}

{p 4 8 2}{cmd:. setgen crinc = crisp(income), cutpt(50000)}	

{p 4 8 2}{cmd:. setgen fzinc = stdrank(income)}

{p 4 8 2}{cmd:. setgen fzinc = drect(income), anchors(10000 50000 90000)}

{p 4 8 2}{cmd:. setgen fzinc = ndrect(income), grpdvar(inccat)}	
{p_end}


{title:Also see}

{psee}
Article: {it:Stata Journal}, volume 8, number 1: {browse "http://www.stata-journal.com/article.html?article=st0140":st0140}
{p_end}
