Login  Register

Re: Identify if column set is less than x and create columns

Posted by Andy W on Sep 19, 2022; 12:24pm
URL: http://spssx-discussion.165.s1.nabble.com/Identify-if-column-set-is-less-than-x-and-create-columns-tp5741057p5741059.html

You can create a fake dummy dataset with all of your columns, and then use ADD FILES to add this to your actual data. In the real data these will then be missing.

*******************************************************.
* Making a fake dummy dataset with all of the columns.
* And no rows.
DATA LIST FREE / Term S1 TO S6.
DATASET NAME Dummy.
BEGIN DATA
END DATA.

* Example not full data.
DATA LIST FREE / Term S1 S2 S3.
BEGIN DATA
1 1 2 3
END DATA.
DATASET NAME RealData.
DATASET ACTIVATE RealData

* Union those two datasets together.
* Get rid of the fake row.
ADD FILES FILE=* /FILE = 'Dummy'.
EXECUTE.
*******************************************************.
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/