.- help for ^varset^ .- Associate variable name with keyword ------------------------------------ ^varset^ [keyword [varname]] [^,^ ^clear^ ] Description ----------- ^varset^ associates a variable with a keyword so that the variable can be used by a family of commands without being specified each time a command is issued. Some families of commands (e.g., ^svy^ and ^xt^) require that an option specify a variable name to identify a particular variable, e.g., a group identifier. ^varset^ can be used to specify this variable at the outset. Associations made by ^varset^ are saved with a dataset; if a dataset is saved after a keyword is set, it does not have to be set again. ^varset^ can be used in the following ways: . ^varset keyword varname^ [associates keyword <--> varname] . ^varset keyword^ [displays varname associated with keyword] . ^varset^ [displays all keyword associations] . ^varset keyword, clear^ [clears keyword association] . ^varset, clear^ [clears all keyword associations] Note: Using the option on a command corresponding to a keyword also sets the keyword association; see example below. Command families for ^varset^: Command Family Keyword Sets Description ------- ------- -------- ----------------------------------- ^svy^ ^strata^ ^strata()^ strata variable ^psu^ ^psu()^ PSU (primary sampling unit) variable ^fpc^ ^fpc()^ finite population correction variable ^pweight^ ^[pweight= ]^ sampling weight variable ^xt^ ^iis^ ^i()^ unit ID variable ^tis^ ^t()^ time variable See help @svy@ and @xt@ for more information. Options ------- ^clear^ clears the association for a specified keyword if a keyword is given. If no keyword is specified, it clears all keywords. After using this option, it will be as if the keyword(s) were never set. Examples -------- ^svymean^ allows for the specification of a stratum identifier variable. This can be done using ^varset^: . ^varset strata region^ The variable ^region^ is now associated with the keyword ^strata^, and the ^strata()^ option does not have to be specified when the ^svymean^ command is issued: . ^svymean income age educ^ Alternatively, the ^strata()^ option could have been used when issuing the ^svymean^ command: . ^svymean income age educ, strata(region)^ Giving the above command also associates ^region^ with the ^strata^ keyword; the association is exactly the same as having typed ^varset strata region^. In subsequent use of any of the ^svy^ commands, ^region^ will be taken to be the ^strata^ variable. To change the keyword association, simply reset it: . ^varset strata stratnum^ To display the name of the variable associated with ^strata^: . ^varset strata^ To display all keyword associations: . ^varset^ To clear the keyword association: . ^varset strata, clear^ To clear all keyword associations: . ^varset, clear^ More examples of setting keyword associations: . ^varset psu clustid^ . ^varset fpc Nh^ . ^varset pweight finalwgt^ . ^varset iis id^ . ^varset tis time^ Also see -------- Manual: [5s] xt On-line: help for @svy@, @xt@