全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
206 1
2014-09-10
悬赏 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;
二维码

扫码加我 拉你入群

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

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

全部回复
2014-9-10 08:23:23
dcount=intck('day',Start_Date,End_Date);
proc print;
var=dcount;
run;
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群