.- help for ^with^ (STB-40: dm52) .- Executing a command on a subset of data --------------------------------------- To execute a command on a subset of the data ^with^ [varlist] [^if^ exp] [^in^ range] [^, nos^ave] ^:^ stata_cmd Description ----------- ^with^ temporarily drops all but a subset of the data and carries out the stata_cmd on the kept data. Any new variables or changes to the subset of the data resulting from the stata_cmd will be saved together with the original data. Essentially ^with^ does "keep [if] [in]" followed by "keep [varlist]". ^with^ is useful when one has a very large data set and the stata_cmd creates many temporary variables. It can also be used with "home-made" programs that do not handle "if" and "in" properly. ^nosave^ leaves the data unchanged after execution of the stata_cmd. The default is to combine any new variables created or changes made by stata_cmd with the original data. Examples -------- . ^with y x if group==3: running y x, gen(yfit)^ . ^with meas* in 14001/15000: for meas*: replace @@=@@+1^ Author ------ Peter Sasieni Imperial Cancer Research Fund London email: p.sasieni@@icrf.icnet.uk Also See -------- STB: STB-40 dm52