| 所在主题: | |
| 文件名: data.zip | |
| 资料下载链接地址: https://bbs.pinggu.org/a-1912829.html | |
本附件包括:
|
|
| 附件大小: | |
|
大家好,本人是SAS小白一枚,目前项目必须用SAS。
我现在有一个很大的数据集,里面每个观测包含3个变量,分别是tag,time, 和lying。每个tag下每天有24个时间值,对应24个lying值。目标是做每个tag下每个时间内lying值的线性回归。假设我有100个tag,则要做100*24次线性回归。 这是一个双重循环的问题,我知道怎么选出每个tag下每个time的值,并对其回归,但是不会循环这个过程。而且回归的结果输出在一result窗口里,能不能像matlab那样,将这些回归结果输出的到变量里,然后统一输出到一个excel文件里?以下是我目前的代码,一次只能处理一个tag,然后手动改tag值,再运行代码。能不能自动识别tag值,然后逐个对这些tag进行回归?由于不会循环,所以用的最笨办手动循环的方法,请不要嘲笑我。。。 再重复下我的目标,1自动识别tag值,并自动对每个tag值的24个时间段的值进行回归。2 将回归结果按tag 和时间段输出到excel文件中。 如果有人能实在上述功能,请联系我,可付报酬。论坛币,或者别的什么币都可以。 数据:代码: proc import datafile="Z:/nicky/data.csv" out=mydata dbms=csv replace; getnames=no; run; proc contents data=mydata; run; Data Cowtag; Set Mydata; If VAR1 = 1332 then output; Run; Data Cowlying0 Cowlying1 Cowlying2 Cowlying3 Cowlying4 Cowlying5 Cowlying6 Cowlying7 Cowlying8 Cowlying9 Cowlying10 Cowlying11 Cowlying12 Cowlying13 Cowlying14Cowlying15 Cowlying16 Cowlying17 Cowlying18 Cowlying19 Cowlying20 Cowlying21 Cowlying22 Cowlying23; Set Cowtag; If VAR3 = "0:00:00" then output Cowlying0; If VAR3 = "1:00:00" then output Cowlying1; If VAR3 = "2:00:00" then output Cowlying2; If VAR3 = "3:00:00" then output Cowlying3; If VAR3 = "4:00:00" then output Cowlying4; If VAR3 = "5:00:00" then output Cowlying5; If VAR3 = "6:00:00" then output Cowlying6; If VAR3 = "7:00:00" then output Cowlying7; If VAR3 = "8:00:00" then output Cowlying8; If VAR3 = "9:00:00" then output Cowlying9; If VAR3 = "10:00:00" then output Cowlying10; If VAR3 = "11:00:00" then output Cowlying11; If VAR3 = "12:00:00" then output Cowlying12; If VAR3 = "13:00:00" then output Cowlying13; If VAR3 = "14:00:00" then output Cowlying14; If VAR3 = "15:00:00" then output Cowlying15; If VAR3 = "16:00:00" then output Cowlying16; If VAR3 = "17:00:00" then output Cowlying17; If VAR3 = "18:00:00" then output Cowlying18; If VAR3 = "19:00:00" then output Cowlying19; If VAR3 = "20:00:00" then output Cowlying20; If VAR3 = "21:00:00" then output Cowlying21; If VAR3 = "22:00:00" then output Cowlying22; If VAR3 = "23:00:00" then output Cowlying23; Run; Data Cowlying0; Set Cowlying0; h=substr(VAR6,1,1); m=substr(VAR6,3,2); y0=h*60+m; x0=_n_; Run; proc reg; model y0=x0; run; Data Cowlying1; Set Cowlying1; h=substr(VAR6,1,1); m=substr(VAR6,3,2); y1=h*60+m; x1=_n_; Run; proc reg; model y1=x1; run; Data Cowlying2; Set Cowlying2; h=substr(VAR6,1,1); m=substr(VAR6,3,2); y2=h*60+m; x2=_n_; Run; proc reg; model y2=x2; run; Data Cowlying3; Set Cowlying3; h=substr(VAR6,1,1); m=substr(VAR6,3,2); y3=h*60+m; x3=_n_; Run; proc reg; model y3=x3; run; …… 一直重复到cowlying23 |
|
熟悉论坛请点击新手指南
|
|
| 下载说明 | |
|
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。 2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。 3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。 (如有侵权,欢迎举报) |
|
京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明