楼主: lranwwy
226 1

SAS 题目请教 [推广有奖]

  • 0关注
  • 0粉丝

大专生

6%

还不是VIP/贵宾

-

威望
0
论坛币
126 个
通用积分
0.8500
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
1019 点
帖子
12
精华
0
在线时间
51 小时
注册时间
2013-2-17
最后登录
2025-5-30

楼主
lranwwy 发表于 2014-9-10 08:23:22 |AI写论文
20论坛币
请教下sas大神,本人才学sas。遇到了一个题目希望大神帮忙post程序上来,小弟不甚感激!!!谢谢!!!
题目如下:

The dataset below contains enrollment records for students.Write code to count the number of days each student was enrolled. Include boththe start date and the end date in the count. Beware of overlapping dateranges. As an example student 1’s count should be.


data Enrollment;

      informat Start_Date MMDDYY10. End_Date MMDDYY10.;

      format Start_Date MMDDYY10. End_Date MMDDYY10.;

      infile datalines dlm=',';

      input Student_Id Start_Date End_Date;

      datalines;

     1,8/20/2012,8/23/2012

     1,8/21/2012,8/25/2012

     2,8/20/2012,8/22/2012

     2,8/24/2012,8/25/2012

     3,8/20/2012,8/23/2012

     4,8/22/2012,8/23/2012

     3,8/22/2012,8/23/2012

     4,8/23/2012,8/24/2012

     3,8/24/2012,8/24/2012

run;


最佳答案

saloim 查看完整内容

dcount=intck('day',Start_Date,End_Date); proc print; var=dcount; run;
关键词:Overlapping enrollment informat Students Student false Style 程序

沙发
saloim 发表于 2014-9-10 08:23:23
dcount=intck('day',Start_Date,End_Date);
proc print;
var=dcount;
run;

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-21 18:47