楼主: 3486863108
1239 3

[SAS EM] 批量导入如下数据 [推广有奖]

  • 0关注
  • 0粉丝

本科生

35%

还不是VIP/贵宾

-

威望
0
论坛币
433 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
176 点
帖子
5
精华
0
在线时间
172 小时
注册时间
2019-1-31
最后登录
2022-3-24

楼主
3486863108 发表于 2020-6-28 23:28:13 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:批量导入

QQ图片20200628232849.png (79.32 KB)

QQ图片20200628232849.png

沙发
3486863108 发表于 2020-6-28 23:29:56
导入一份数据的代码为,一共29个
  1. Data Res_sas.DRESSTK_2016__2(label="日股票综合数据(2016-)");
  2. Infile 'D:\Res_sas\RESSET_DRESSTK_2016__2.txt' delimiter = '09'x Missover Dsd lrecl=32767 firstobs=2 ;
  3. Format Stkcd $6.;
  4. Format Listedstate $5.;
  5. Format Date YYMMDD10.;
  6. Format PrevClPr 10.3;
  7. Format Oppr 10.3;
  8. Format Hipr 10.3;
  9. Format Lopr 10.3;
  10. Format Clpr 10.3;
  11. Format AdjClpr1 COMMA15.3;
  12. Format AdjClpr2 COMMA15.3;
  13. Format Trdvol 20.;
  14. Format Trdsum 20.2;
  15. Format Dampltd 15.2;
  16. Format DFulTurnR 15.4;
  17. Format DTrdTurnR 15.4;
  18. Format Capchgdt YYMMDD10.;
  19. Format Comstateshr 20.;
  20. Format Comlpshr 20.;
  21. Format Fullshr 20.;
  22. Format Trdshr 20.;
  23. Format Lsttrdshr 20.;
  24. Format Mcfacpr 10.4;
  25. Format Dret 10.4;
  26. Format Daret 10.4;
  27. Format Dreteq 10.4;
  28. Format Drettmv 10.4;
  29. Format Dretmc 10.4;
  30. Format Dareteq 10.4;
  31. Format Darettmv 10.4;
  32. Format Daretmc 10.4;
  33. Format DRfRet 10.4;
  34. Format PE COMMA23.2;
  35. Format PB COMMA23.2;
  36. Format PCF COMMA23.2;
  37. Format PS COMMA23.2;
  38. Format EPS COMMA10.3;
  39. Format ROE 16.6;
  40. Format AccumFundPS COMMA10.2;
  41. Format OpPrfPS COMMA10.2;
  42. Format NAPS COMMA10.2;
  43. Format NAPSadj COMMA10.2;
  44. Format IncomePS COMMA10.2;
  45. Format NCFfropePS COMMA10.2;
  46. Informat Stkcd $6.;
  47. Informat Listedstate $5.;
  48. Informat Date YYMMDD10.;
  49. Informat PrevClPr 10.3;
  50. Informat Oppr 10.3;
  51. Informat Hipr 10.3;
  52. Informat Lopr 10.3;
  53. Informat Clpr 10.3;
  54. Informat AdjClpr1 COMMA15.3;
  55. Informat AdjClpr2 COMMA15.3;
  56. Informat Trdvol 20.;
  57. Informat Trdsum 20.2;
  58. Informat Dampltd 15.2;
  59. Informat DFulTurnR 15.4;
  60. Informat DTrdTurnR 15.4;
  61. Informat Capchgdt YYMMDD10.;
  62. Informat Comstateshr 20.;
  63. Informat Comlpshr 20.;
  64. Informat Fullshr 20.;
  65. Informat Trdshr 20.;
  66. Informat Lsttrdshr 20.;
  67. Informat Mcfacpr 10.4;
  68. Informat Dret 10.4;
  69. Informat Daret 10.4;
  70. Informat Dreteq 10.4;
  71. Informat Drettmv 10.4;
  72. Informat Dretmc 10.4;
  73. Informat Dareteq 10.4;
  74. Informat Darettmv 10.4;
  75. Informat Daretmc 10.4;
  76. Informat DRfRet 10.4;
  77. Informat PE COMMA23.2;
  78. Informat PB COMMA23.2;
  79. Informat PCF COMMA23.2;
  80. Informat PS COMMA23.2;
  81. Informat EPS COMMA10.3;
  82. Informat ROE 16.6;
  83. Informat AccumFundPS COMMA10.2;
  84. Informat OpPrfPS COMMA10.2;
  85. Informat NAPS COMMA10.2;
  86. Informat NAPSadj COMMA10.2;
  87. Informat IncomePS COMMA10.2;
  88. Informat NCFfropePS COMMA10.2;
  89. Label Stkcd="股票代码";
  90. Label Listedstate="上市状态";
  91. Label Date="日期";
  92. Label PrevClPr="前收盘价";
  93. Label Oppr="开盘价";
  94. Label Hipr="最高价";
  95. Label Lopr="最低价";
  96. Label Clpr="收盘价";
  97. Label AdjClpr1="复权价1";
  98. Label AdjClpr2="复权价2";
  99. Label Trdvol="成交量";
  100. Label Trdsum="成交金额";
  101. Label Dampltd="日振幅";
  102. Label DFulTurnR="总股数日换手率";
  103. Label DTrdTurnR="流通股日换手率";
  104. Label Capchgdt="股数变动日";
  105. Label Comstateshr="公司国有股";
  106. Label Comlpshr="公司法人股";
  107. Label Fullshr="总股数";
  108. Label Trdshr="流通股";
  109. Label Lsttrdshr="已上市流通股";
  110. Label Mcfacpr="累积股价调整乘子";
  111. Label Dret="日收益率";
  112. Label Daret="日资本收益率";
  113. Label Dreteq="等权平均市场日收益率";
  114. Label Drettmv="流通市值加权平均市场日收益率";
  115. Label Dretmc="总市值加权平均市场日收益率";
  116. Label Dareteq="等权平均市场日资本收益率";
  117. Label Darettmv="流通市值加权平均市场日资本收益";
  118. Label Daretmc="总市值加权平均日资本收益";
  119. Label DRfRet="日无风险收益率";
  120. Label PE="市盈率";
  121. Label PB="市净率";
  122. Label PCF="市现率";
  123. Label PS="市销率";
  124. Label EPS="每股收益(摊薄)";
  125. Label ROE="净资产收益率(摊薄)";
  126. Label AccumFundPS="每股公积金";
  127. Label OpPrfPS="每股营业利润";
  128. Label NAPS="每股净资产";
  129. Label NAPSadj="调整后每股净资产";
  130. Label IncomePS="每股营业收入";
  131. Label NCFfropePS="每股经营活动现金流量净额";
  132. Input  Stkcd [        DISCUZ_CODE_1        ]nbsp; Listedstate [        DISCUZ_CODE_1        ]nbsp; Date  PrevClPr  Oppr  Hipr  Lopr  Clpr  AdjClpr1  AdjClpr2  Trdvol  Trdsum  Dampltd  DFulTurnR  DTrdTurnR  Capchgdt  Comstateshr  Comlpshr  Fullshr
  133. Trdshr  Lsttrdshr  Mcfacpr  Dret  Daret  Dreteq  Drettmv  Dretmc  Dareteq  Darettmv  Daretmc  DRfRet  PE  PB  PCF  PS  EPS  ROE  AccumFundPS  OpPrfPS
  134. NAPS  NAPSadj  IncomePS  NCFfropePS ;
  135. Run;
复制代码

藤椅
hyb971006 发表于 2020-7-9 17:03:31
是需要嵌套一个宏循环?&i改了下 不知道具体数据格式是什么样 暂时放一下代码吧 不一定能跑出来
  1. %macro mdf();
  2. %do i=1 %to 29;
  3. Data Res_sas.DRESSTK_2016__&i(label="日股票综合数据(2016-&i)");
  4. Infile 'D:\Res_sas\RESSET_DRESSTK_2016__&i..txt' delimiter = '09'x Missover Dsd lrecl=32767 firstobs=2 ;
  5. Format Stkcd $6.;
  6. Format Listedstate $5.;
  7. Format Date YYMMDD10.;
  8. Format PrevClPr 10.3;
  9. Format Oppr 10.3;
  10. Format Hipr 10.3;
  11. Format Lopr 10.3;
  12. Format Clpr 10.3;
  13. Format AdjClpr1 COMMA15.3;
  14. Format AdjClpr2 COMMA15.3;
  15. Format Trdvol 20.;
  16. Format Trdsum 20.2;
  17. Format Dampltd 15.2;
  18. Format DFulTurnR 15.4;
  19. Format DTrdTurnR 15.4;
  20. Format Capchgdt YYMMDD10.;
  21. Format Comstateshr 20.;
  22. Format Comlpshr 20.;
  23. Format Fullshr 20.;
  24. Format Trdshr 20.;
  25. Format Lsttrdshr 20.;
  26. Format Mcfacpr 10.4;
  27. Format Dret 10.4;
  28. Format Daret 10.4;
  29. Format Dreteq 10.4;
  30. Format Drettmv 10.4;
  31. Format Dretmc 10.4;
  32. Format Dareteq 10.4;
  33. Format Darettmv 10.4;
  34. Format Daretmc 10.4;
  35. Format DRfRet 10.4;
  36. Format PE COMMA23.2;
  37. Format PB COMMA23.2;
  38. Format PCF COMMA23.2;
  39. Format PS COMMA23.2;
  40. Format EPS COMMA10.3;
  41. Format ROE 16.6;
  42. Format AccumFundPS COMMA10.2;
  43. Format OpPrfPS COMMA10.2;
  44. Format NAPS COMMA10.2;
  45. Format NAPSadj COMMA10.2;
  46. Format IncomePS COMMA10.2;
  47. Format NCFfropePS COMMA10.2;
  48. Informat Stkcd $6.;
  49. Informat Listedstate $5.;
  50. Informat Date YYMMDD10.;
  51. Informat PrevClPr 10.3;
  52. Informat Oppr 10.3;
  53. Informat Hipr 10.3;
  54. Informat Lopr 10.3;
  55. Informat Clpr 10.3;
  56. Informat AdjClpr1 COMMA15.3;
  57. Informat AdjClpr2 COMMA15.3;
  58. Informat Trdvol 20.;
  59. Informat Trdsum 20.2;
  60. Informat Dampltd 15.2;
  61. Informat DFulTurnR 15.4;
  62. Informat DTrdTurnR 15.4;
  63. Informat Capchgdt YYMMDD10.;
  64. Informat Comstateshr 20.;
  65. Informat Comlpshr 20.;
  66. Informat Fullshr 20.;
  67. Informat Trdshr 20.;
  68. Informat Lsttrdshr 20.;
  69. Informat Mcfacpr 10.4;
  70. Informat Dret 10.4;
  71. Informat Daret 10.4;
  72. Informat Dreteq 10.4;
  73. Informat Drettmv 10.4;
  74. Informat Dretmc 10.4;
  75. Informat Dareteq 10.4;
  76. Informat Darettmv 10.4;
  77. Informat Daretmc 10.4;
  78. Informat DRfRet 10.4;
  79. Informat PE COMMA23.2;
  80. Informat PB COMMA23.2;
  81. Informat PCF COMMA23.2;
  82. Informat PS COMMA23.2;
  83. Informat EPS COMMA10.3;
  84. Informat ROE 16.6;
  85. Informat AccumFundPS COMMA10.2;
  86. Informat OpPrfPS COMMA10.2;
  87. Informat NAPS COMMA10.2;
  88. Informat NAPSadj COMMA10.2;
  89. Informat IncomePS COMMA10.2;
  90. Informat NCFfropePS COMMA10.2;
  91. Label Stkcd="股票代码";
  92. Label Listedstate="上市状态";
  93. Label Date="日期";
  94. Label PrevClPr="前收盘价";
  95. Label Oppr="开盘价";
  96. Label Hipr="最高价";
  97. Label Lopr="最低价";
  98. Label Clpr="收盘价";
  99. Label AdjClpr1="复权价1";
  100. Label AdjClpr2="复权价2";
  101. Label Trdvol="成交量";
  102. Label Trdsum="成交金额";
  103. Label Dampltd="日振幅";
  104. Label DFulTurnR="总股数日换手率";
  105. Label DTrdTurnR="流通股日换手率";
  106. Label Capchgdt="股数变动日";
  107. Label Comstateshr="公司国有股";
  108. Label Comlpshr="公司法人股";
  109. Label Fullshr="总股数";
  110. Label Trdshr="流通股";
  111. Label Lsttrdshr="已上市流通股";
  112. Label Mcfacpr="累积股价调整乘子";
  113. Label Dret="日收益率";
  114. Label Daret="日资本收益率";
  115. Label Dreteq="等权平均市场日收益率";
  116. Label Drettmv="流通市值加权平均市场日收益率";
  117. Label Dretmc="总市值加权平均市场日收益率";
  118. Label Dareteq="等权平均市场日资本收益率";
  119. Label Darettmv="流通市值加权平均市场日资本收益";
  120. Label Daretmc="总市值加权平均日资本收益";
  121. Label DRfRet="日无风险收益率";
  122. Label PE="市盈率";
  123. Label PB="市净率";
  124. Label PCF="市现率";
  125. Label PS="市销率";
  126. Label EPS="每股收益(摊薄)";
  127. Label ROE="净资产收益率(摊薄)";
  128. Label AccumFundPS="每股公积金";
  129. Label OpPrfPS="每股营业利润";
  130. Label NAPS="每股净资产";
  131. Label NAPSadj="调整后每股净资产";
  132. Label IncomePS="每股营业收入";
  133. Label NCFfropePS="每股经营活动现金流量净额";
  134. Input Stkcd Listedstate Date  PrevClPr  Oppr  Hipr  Lopr  Clpr  AdjClpr1  AdjClpr2  Trdvol  Trdsum  Dampltd  DFulTurnR  DTrdTurnR  Capchgdt  Comstateshr  Comlpshr  Fullshr
  135. Trdshr  Lsttrdshr  Mcfacpr  Dret  Daret  Dreteq  Drettmv  Dretmc  Dareteq  Darettmv  Daretmc  DRfRet  PE  PB  PCF  PS  EPS  ROE  AccumFundPS  OpPrfPS
  136. NAPS  NAPSadj  IncomePS  NCFfropePS ;
  137. Run;
  138. %end;
  139. %mend;
  140. %mdf();
复制代码



板凳
xiaopingN 发表于 2020-7-9 22:11:25
03  行 漏了个·&i: Data Res_sas.DRESSTK_2016__&i(label="日股票综合数据(2016-&i)");还有就是没有定义变量的类型和length

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-2-9 04:31