Login  Register

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

Posted by Bruce Weaver on Sep 19, 2022; 1:16pm
URL: http://spssx-discussion.165.s1.nabble.com/Identify-if-column-set-is-less-than-x-and-create-columns-tp5741057p5741060.html

Great idea, Andy.  However, I would suggest adding the RealData to the Dummy dataset so that the variables are in the desired order (in case that is important).  ;-)  

ADD FILES FILE='Dummy' /FILE = 'Realdata'.
EXECUTE.


Andy W wrote
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.
*******************************************************.
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).