Login  Register

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

Posted by jkpeck on Sep 18, 2022; 7:35pm
URL: http://spssx-discussion.165.s1.nabble.com/Identify-if-column-set-is-less-than-x-and-create-columns-tp5741057p5741058.html

The COUNT subcommand produces a variable of the number of rows in the input that were used to generate the new variables.  So, if I understand your setup, you would need to generate new, empty variables to fill out that number to six.  You could use a VECTOR command like
VECTOR V(n, A20).
to generate a set of instructor variables, where n is the number needed, which would be 6 minus the maximum of the COUNT variable or however many additional variable names you need.

But, an easy way to do that without Python doesn't come to mind.  However, Python is always installed for Statistics in recent versions, so you should be able to rely on that.  There has not been the option to omit it for several versions back.

If you want to pursue this approach, I can help, but I would need to see a small sample of the data after the CASESTOVARS step and the list of expected instructor variable names. (jkpeck@gmail.com).  (The actual data doesn't matter).

If I am on the wrong track, a sample of the data would help with that, too.