在下有一个数据文件,需要建立十个投资组合,第一个组合要包含每个月msmvosd(流通市值)最小的10%的股票,第二个组合需要有倒数的第2个10%的股票,以此类推。求运行代码。(简单的说就是分成十组,每组包含10%的股票信息,这些股票按流通市值排序)
标签解释:
Stkcd [证券代码] - 以上交所、深交所公布的证券代码为准
Trdmnt [交易月份] - 以YYYY-MM表示
Mclsprc [月收盘价] -
Mnshrtrd [月个股交易股数] - 月内该股票的交易数量
Mnvaltrd [月个股交易金额] - 月内该股票的交易金额;A股以人民币元计,上海B以美元计,深圳B以港币计
Msmvosd [月个股流通市值] - 个股的流通股数与月收盘价的乘积。 A股以人民币元计,上海B以美元计,深圳B以港币计,注意单位是千
Msmvttl [月个股总市值] - 个股的发行总股数与月收盘价的乘积,A股以人民币元计,上海B股以美元计,深圳B股以港币计,注意单位是千
Mretwd [考虑现金红利再投资的月个股回报率] - 字段说明见“回报率计算方法
引用代码为:
DATA GTA_SAS.TRD_Mnth (Label="月个股回报率文件");
Infile 'D:\GTA_SAS\TRD_Mnth.txt' encoding="utf-8" delimiter = '09'x Missover Dsd lrecl=32767 firstobs=2;
Format Stkcd $6.;
Format Trdmnt $7.;
Format Mclsprc 9.3;
Format Mnshrtrd 38.;
Format Mnvaltrd 38.3;
Format Msmvosd 16.2;
Format Msmvttl 16.2;
Format Mretwd 10.6;
Informat Stkcd $6.;
Informat Trdmnt $7.;
Informat Mclsprc 9.3;
Informat Mnshrtrd 38.;
Informat Mnvaltrd 38.3;
Informat Msmvosd 16.2;
Informat Msmvttl 16.2;
Informat Mretwd 10.6;
Label Stkcd="证券代码";
Label Trdmnt="交易月份";
Label Mclsprc="月收盘价";
Label Mnshrtrd="月个股交易股数";
Label Mnvaltrd="月个股交易金额";
Label Msmvosd="月个股流通市值";
Label Msmvttl="月个股总市值";
Label Mretwd="考虑现金红利再投资的月个股回报率";
Input Stkcd $ Trdmnt $ Mclsprc Mnshrtrd Mnvaltrd Msmvosd Msmvttl Mretwd ;
Run;