Hi, I'm trying to import the csv file that I downloaded from Bloomberg. I tried the method that I used before but it does not work properly (Error message in log). I attached the code and screenshot of csv file and SAS result here. Any suggestion for improving the code? Thanks a lot!
PROC IMPORT OUT= Bloomberg /*Import three inventory data*/
DATAFILE= "E:\one_drive\OneDrive\Thesis\2017_Xusheng\Update1\1-Price\Data\Inventory\Bloomberg.csv"
DBMS=CSV REPLACE;
GETNAMES=YES;
DATAROW=2;
Run;
CSV file
SAS Result
Log error message
Try another option.
PROC IMPORT OUT= Bloomberg /*Import three inventory data*/
DATAFILE= "E:\one_drive\OneDrive\Thesis\2017_Xusheng\Update1\1-Price\Data\Inventory\Bloomberg.csv"
DBMS=CSV REPLACE;
GETNAMES=YES;
guessingrows=32767;
DATAROW=2;
Run;
The only errors your log are showing is when the DATE column contains '#VALUE1' instead of a date.
Sounds like you could just ignore the errors since they will only result in the DATE column having a missing value.
Otherwise write you own data step to read the CSV file. You will then have complete control over how to handle those values.
PS You posted a picture of a spreadsheet and labeled it a CSV file. A CSV is a text file. Don't post pictures of text, just post the text. It is clearer, smaller and easier than posting photos. And if you do post a photo then post a photo of the actual object and not a version that has been transformed by being read into a program like Excel.
We cannot tell from the photos what issues you might have with the numbers. Post just a few rows of the actual data in the CSV file and of that data after PROC IMPORT read them (again as text and not photos) and explain it what way that are not correct.
Thank you, Tom. I've found the problem. It was inside my data. Invalid value in the date column ruins the rest of the data. Thank you.
Try another option.
PROC IMPORT OUT= Bloomberg /*Import three inventory data*/
DATAFILE= "E:\one_drive\OneDrive\Thesis\2017_Xusheng\Update1\1-Price\Data\Inventory\Bloomberg.csv"
DBMS=CSV REPLACE;
GETNAMES=YES;
guessingrows=32767;
DATAROW=2;
Run;
Thank you, Ksharp. I've found the problem and fixed that.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.