我正在使用锻炼应用程序的 .csv 导出。它记录日期、时间、锻炼、次数、体重和评论。像许多 .csv 文件一样,它有点乱。
例子:
Date,Time,Exercise,# of Reps,Weight,Comments12/23/2014,14:52,Hip Abduction,30,180,12/23/2014,14:52,Hip Abduction,30,180,12/23/2014,14:51,Inverse Bench,15,95,12/23/2014,14:51,Abb Twist,30,100,12/23/2014,14:51,Pull-Ups,5,170,12/23/2014,14:27,Squat,15,135,12/23/2014,14:27,Squat,15,13512/23/2014,14:27,Squat,15,13512/23/2014,14:27,Deadlift,15,135,12/23/2014,14:27,Crunch,30,170,12/23/2014,14:27,Crunch,30,17012/23/2014,14:27,Crunch,30,17012/23/2014,14:26,Bench,15,135,12/23/2014,14:26,Bench,15,13512/23/2014,14:26,Bench,15,135,etc...
我已经能够导入数据,但是,它将字符数限制为 8 个;如日期和运动变量所示。
SAS 代码:
DATA strength;
infile 'C:\Users\user\Google Drive\strength.csv' DLM = ',' DSD;
input Date $ Time $ Exercise $ Reps Weight Comments;
if date = 'Date' then delete; *removes first obs - the csv header;
RUN;
PROC PRINT data = strength;
title 'Simple Work Out Log Export';
RUN;
SAS 输出:
Obs Date Time Exercise Reps Weight Comments
1 12/23/20 14:52 Hip Abdu 30 180 .
2 12/23/20 14:52 Hip Addu 30 180 .
3 12/23/20 14:51 Inverse 15 95 .
4 12/23/20 14:51 Abb Twis 30 100 .
etc...
我没有很多使用 .csv 文件的经验,但我确实尝试过使用
input Date $ Time $ Exercise $ 12. ....
但这不起作用,因为不同的练习有不同的长度名称。
我将如何为这样的原始 .csv 数据文件导入完整的日期和练习名称?
谢谢!