This query uses the PCAPlot function to compute the first three score variables, which correspond to the first three principal components, accumulating the response variable from the original input data table patient_pca_input:
CREATE DIMENSION TABLE pcr1 AS SELECT * FROM PCAPlot ( ON pca_scaled AS inputtable PARTITION BY ANY ON pca_health_ev2 AS pca_table DIMENSION Accumulate ('pid', 'strokes') Components ('3') ) ORDER BY 1;