全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
3749 4
2010-03-09
有批量.txt数据文件(10几年的数据)存于 "d:\sean\"中,每个.txt文本均包含三个变量:Date   LightrrapData  ModelPrediction,其中LightrrapData  ModelPrediction为两种处理方式下的数据,



我想对这两种处理作不同时间间隔的重复测量分析,很多参考书上说导入数据集里的格式是这样的
group  data              day
1          1                     0
1          1                     9
1          5                     11
1          4                     12
1          2                     13
1          2                     14
2          0.0014             0
2          0.0000             9
2          0.0000             11
2          0.0000             12
2          0.0002             13
2          0.0003             14

我不知道如何转化为这种格式的数据集,即把.TXT文本里的后面两列按时间合并为一列,分别用1和2代表两种处理名称。day为实际调查日期相对于第一次调查(1980/6/3)的时间差。请问如何将数据在数据集里显示为上述格式?

单个.txt(假如按上述格式转化后)重复测量分析代码如下:

/* 数据步待求*/

/* 过程步:*/
  Proc Mixed     covtest Method= Reml;
    Class grade;
    Model Y=grade day grade*day /ddfm=satterth;   /* /Htype=1*/
    Repeated  / TYPE=UN;
                                                                                  /*Lsmeans grade time grade*time /tdiff pdiff;*/
Title 'Fit Unstructured Covariance';
Run;

还有,能否对所有.txt文件批量进行Repeated  analysis?

请各位大侠不吝赐教!谢谢!
二维码

扫码加我 拉你入群

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

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

全部回复
2010-3-9 10:49:37
sean1945 发表于 2010-3-9 10:34
有批量.txt数据文件(10几年的数据)存于 "d:\sean\"中,每个.txt文本均包含三个变量:Date   LightrrapData  ModelPrediction,其中LightrrapData  ModelPrediction为两种处理方式下的数据,



我想对这两种处理作不同时间间隔的重复测量分析,很多参考书上说导入数据集里的格式是这样的
group  data              day
1          1                     0
1          1                     9
1          5                     11
1          4                     12
1          2                     13
1          2                     14
2          0.0014             0
2          0.0000             9
2          0.0000             11
2          0.0000             12
2          0.0002             13
2          0.0003             14

我不知道如何转化为这种格式的数据集,即把.TXT文本里的后面两列按时间合并为一列,分别用1和2代表两种处理名称。day为实际调查日期相对于第一次调查(1980/6/3)的时间差。请问如何将数据在数据集里显示为上述格式?

单个.txt(假如按上述格式转化后)重复测量分析代码如下:

/* 数据步待求*/

/* 过程步:*/
  Proc Mixed     covtest Method= Reml;
    Class grade;
    Model Y=grade day grade*day /ddfm=satterth;   /* /Htype=1*/
    Repeated  / TYPE=UN;
                                                                                  /*Lsmeans grade time grade*time /tdiff pdiff;*/
Title 'Fit Unstructured Covariance';
Run;

还有,能否对所有.txt文件批量进行Repeated  analysis?

请各位大侠不吝赐教!谢谢!
For the question days, you can use either intck function or minus of two days as long as they are SAS dates(numeric integer).
I am not clear about your other questions.


6    data _null_;
7      x='15jun1980'd;
8      days=intck('day','3jun1980'd,'15jun1980'd);
9      days2 = '15jun1980'd -  '3jun1980'd;
10     put x= yymmdd10. days days2;
11     run;

x=1980-06-15 12 12
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
二维码

扫码加我 拉你入群

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

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

2010-3-9 13:49:22
bobguy,  thankyou fou your help.
about my quesitions,
when i import  the .txt datas from "d:\sean\" , it created a dataset as follows:

Date       LighttrapData     ModelPrediction
1980-06-03   1       0.0014
1980-06-12   1       0
1980-06-14    5      0
1980-06-15    4      0
... ...
1980-09-19    48   2.8819

because my procdue of the Repeated analysis of unequally dates, the form should be  the following one:
group  data              day
1          1                     0
1          1                     9
1          5                     11
1          4                     12
1          2                     13
1          2                     14
2          0.0014             0
2          0.0000             9
2          0.0000             11
2          0.0000             12
2          0.0002             13
2          0.0003             14
how can I change the initial data into this form?  Can you show me the code? thankyou!
二维码

扫码加我 拉你入群

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

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

2010-3-10 07:27:10
3# sean1945

复制代码
二维码

扫码加我 拉你入群

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

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

2010-3-10 09:20:10
4# jingju11
Your code works well, thanks very much for your kind!  
I  got a lot of from the bbs.
Also thanks to 2# bobguy!
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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