Table 从变量转换

Table transformation from variables

我的数据集如下所示,但品牌和类别要多得多。

我想调成品牌为一排,属性(质量好,价格实惠)在一列

我试过 VARSTOCASES,我可以从中计算平均值,但这不是我想要的输出

我需要以某种方式拥有品牌名称 - 应该通过

将其从我的所有变量中撤回
compute brand=char.substr(brand, 16)

喜欢

compute brand=char.substr(P1_Good_Quality_BMW, 16)

我对 varstocases 部分没问题,然后我可以将我的输出(如 GQ)放到列中,但不知道如何拥有所有品牌名称并让它们匹配属性的平均值

提前感谢您的帮助

这将以您想要的结构获取数据 - 每个品牌一行,每个属性一列:

varstocases /make GQ from P1_GoodQuality_BMW P1_GoodQuality_Audi P1_GoodQuality_Mercedes
        /make Afford from P2_Affordable_BMW  P2_Affordable_Audi  P2_Affordable_Mercedes
       /index=brand(GQ).
* at this point you should have the table you were trying to create, 
* we'll just extract the brand names properly.
compute brand=char.substr(brand, 16).
execute.
* now we have the data structured nicely, we can aggregate by brand.
dataset declare agg.
aggregate /out=agg /break=brand /GQ Afford = mean (GQ Afford).
dataset activate agg.