將 Excel 資料匯入 SAS
例如,下面說的是 Excel’Test’中的示例資料,
Purchase_Date Customer_Name Price
05-05-2017 Adam 1075
06-05-2017 Noah 1093
07-05-2017 Peter 1072
08-05-2017 Louis 1101
09-05-2017 Zoe 1248
10-05-2017 Kevin 1045
11-05-2017 Messiah 1072
12-05-2017 John 1046
13-05-2017 Stephen 1043
14-05-2017 Solly 1113
15-05-2017 Jeevan 1137
你應該使用以下程式碼成功匯入,
Data Test;
Infile 'D:\Test.csv';
Delimiter=',' Missover DSD Getnames=Yes;
Informat Purchase_Date date9.;
Informat Price dollarx10.2;
Format Purchase_Date date9.;
Format Price dollarx10.2;
run;
Informat in the above code helps SAS to read the data from Excel. Format in the above code helps to write the data properly into SAS Data set.