BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Xusheng
Obsidian | Level 7

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 fileCSV fileSAS ResultSAS Result Log error messageLog error message

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

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;

View solution in original post

6 REPLIES 6
Tom
Super User Tom
Super User

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.

Xusheng
Obsidian | Level 7
Thank you for replying, yes, I read the error message and did not
figure out how it affects my result. The date and event names are good but
the problem is with the numbers. Probably I will just create my own data
step.

I will keep in mind regarding the posting pictures.
Tom
Super User Tom
Super User

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.

Xusheng
Obsidian | Level 7

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.

Ksharp
Super User

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;

Xusheng
Obsidian | Level 7

Thank you, Ksharp. I've found the problem and fixed that. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1111 views
  • 1 like
  • 3 in conversation