|
UNSTACKName:
However, there may be occasions where it is more convenient to work with the data were the data for each group is in a separate response variable. This command performs this conversion. Currently, group-id variables with up to 99 distinct values are supported (if the group-id variable has more than 99 distinct values, an error message will be generated). This command is the reverse of the STACK command which converts from the multi-column form to the single response variable with group-id variable form.
where <y> is a response variable; <x> is a group-id variable; <z> is the base name for the generated response variables; and where the <SUBSET/EXCEPT/FOR qualification> is optional. The <z> is the base name for the new response variables. So if Z is the base name and there are five distinct values in the group-id variable, this command will generate the new response variables Z1, Z2, Z3, Z4 and Z5. The Z variable will contain the distinct values of the group-id variable.
LET Z = UNSTACK Y X SUBSET X > 2
dimension 100 columns skip 25 read gear.dat y x . let z = unstack y x set write decimals 4 print z1 z2 z3 z4 z5 print z6 z7 z8 z9 z10 print z --------------------------------------------------------------------------- Z1 Z2 Z3 Z4 Z5 --------------------------------------------------------------------------- 1.0060 0.9980 0.9910 1.0050 0.9980 0.9960 1.0060 0.9870 1.0020 0.9980 0.9980 1.0000 0.9970 0.9940 0.9820 1.0000 1.0020 0.9990 1.0000 0.9900 0.9920 0.9970 0.9950 0.9950 1.0020 0.9930 0.9980 0.9940 0.9940 0.9840 1.0020 0.9960 1.0000 0.9980 0.9960 0.9990 1.0000 0.9990 0.9960 0.9930 0.9940 1.0060 0.9960 1.0020 0.9800 1.0000 0.9880 0.9960 0.9960 0.9960 --------------------------------------------------------------------------- Z6 Z7 Z8 Z9 Z10 --------------------------------------------------------------------------- 1.0090 0.9900 0.9980 1.0020 0.9910 1.0130 1.0040 1.0000 0.9980 0.9950 1.0090 0.9960 1.0060 0.9960 0.9840 0.9970 1.0010 1.0000 0.9950 0.9940 0.9880 0.9980 1.0020 0.9960 0.9970 1.0020 1.0000 0.9960 1.0040 0.9970 0.9950 1.0180 0.9980 1.0040 0.9910 0.9980 1.0100 0.9960 0.9980 0.9980 0.9810 0.9960 1.0020 0.9990 1.0040 0.9960 1.0020 1.0060 0.9910 0.9970 --------------- Z --------------- 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 9.0000 10.0000
|
Privacy
Policy/Security Notice
NIST is an agency of the U.S.
Commerce Department.
Date created: 01/24/2017 |