|
|
NSPLIT: Split numeric variables with integer values into new smaller numeric variablesIf you want to use nsplit, then feel free to use Stata's command net install:net install nsplit , from(http://fauculty.fuqua.duke.edu/home/blanc004/sas_to_stata/) replaceDisclaimer: There is no warranty on this software either expressed or implied. This program is released under the terms and conditions of GNU General Public License. About nsplit
Programmer: Dan Blanchette ()
Center for Entrepreneurship and Innovation Duke University's Fuqua School of Business Durham, NC USA Developed at The Carolina Population Center at The University of North Carolina at Chapel Hill Date: 30Nov2004 Last updated: 02Dec2004 Split numeric variables with integer values into new smaller numeric variables.
nsplit [varname] [if exp] [in range]
, digits(digit pattern in existing variable) [generate(newvarlist or stub)]
Description
nsplit creates however many new numeric variables it takes to split a numeric variable into digit
pattern. If your existing numeric variable contains decimal values, then nsplit will only split
the integer portion of the number.
Options
digits(digit pattern in existing variable) describes the pattern in the existing
numeric variable. If it is a repeated pattern then you only need to supply the number of digits the new variables
should contain. For example:
. nsplit id, digits(2) for an ID variable with 6 digits is equivalent to: . nsplit id, digits(2 2 2)
generate(newvarlist or stub) states what you want the new variable names to
be. If only one name is listed than that will be the first characters of the new variable names:
stub1 stub2 etc. If no new variable name is en the original variable name will be used as the stub.
Examples. nsplit id, digits(2 3) . list id* . nsplit date, digits(2) generate(month year) . list date month year date month year 1294 12 94 588 5 88 Acknowledgements
Many suggestions were implemented that were made by:
Nicholas J. Cox, University of Durham, U.K. Also seeBack to Main Page Questions or comments? Send them to Dan Blanchette () |