Examples (CASESTOVARS command)

The following is the LIST output for a data file in which repeated measurements for the same case are stored on separate rows in a single variable.

insure     caseid    month      bps      bpd 
 
BCBS            1        1      160      100 
BCBS            2        1      120       70 
BCBS            2        2      130       86 
Prucare         1        1      160       94 
Prucare         1        2      200      105 
Prucare         1        3      180      105 
Pruecare        2        1      135       90 

The commands:

SPLIT FILE BY insure.
CASESTOVARS 
	/ID=caseid
	/INDEX=month.

create a new variable group for bps and a new group for bpd. The LIST output for the new active dataset is as follows:

  • The row groups in the original data are identified by insure and caseid.
  • There are four row groups—one for each combination of the values in insure and caseid.
  • The command creates four rows in the new data file, one for each row group.
  • The candidate variables from the original file are bps and bpd. They vary within the row group, so they will become variable groups in the new data file.
  • The command creates two new variable groups—one for bps and one for bpd.
  • Each variable group contains three new variables—one for each unique value of the index variable month.