/* Simulate 10000 rows of 1000 columns */.
MATRIX.
SAVE UNIFORM(10000,1000)/OUTFILE */VARIABLES x0001 TO x1000.
END MATRIX.
COMPUTE ID=$CASENUM.
EXECUTE.
/* Wish to restructure each original row into 20 rows of 50 columns */.
/* This would require 50 MAKE subcommands in VARSTOCASES.
/* (ie. Explicitely typing 1000 variable names if structured as
/* PiQj and wanting P as rows with Q as columns.
/* Alternatively one could use XSAVE within a LOOP with supporting vectors.
/* Downside need to write to disk and indexing can be a little confusing .
/* Downside to my !V2C is that data have to fit in memory
(or call multiple times with partitions of the data).
/* vars have to be all numeric (or modify the SAVE to be string aware).
DEFINE !V2C (
vars !CHAREND ("/")
/ id !CHAREND ("/")
/ nrow !CHAREND ("/")
/ pindex !CHAREND ("/")
/ colnames !CHAREND ("/") )
MATRIX.
GET ID /FILE * /VARIABLES !id.
GET qdata /FILE * /VARIABLES !vars.
SAVE {KRONEKER(ID,MAKE(!nrow,1,1)),KRONEKER(MAKE(NROW(qdata),1,1),T({1:!nrow})),
RESHAPE(qdata,NROW(Qdata)*!nrow,NCOL(Qdata)/!nrow)}
/OUTFILE *
/VARIABLES !id !pindex !colnames.
END MATRIX.
!ENDDEFINE.
!V2C vars x0001 TO x1000/id id /nrow 20 /pindex index/colnames q01 TO q50.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"