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

Greetings,

 

1. I'm using PROC IMPORT CSV with Guessing Rows = MAX to read a CSV File in Enterprise Guide.

2. I have 2 DateTime columns which has some issues. After execution is done, the dataset is being created, but I get error message.

3. Ideally, I would like to make the system to ignore the error message. I'm accepting the fact that some of the rows will be with missing data.

4. Details Below:

4.1. Code:

DanielDor_0-1634104327397.png

4.2. Error Message (rows created BUT error message with import unsuccessful): 

DanielDor_1-1634104393424.png

4.3 Results in Guide:

DanielDor_2-1634104472425.png

 

5. Could you please assist?

 

Thanks!

 

Daniel

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

You NEVER ignore ERRORs or WARNINGs, you correct them.

With CSV files, write the data step yourself instead of relying on the guesses of PROC IMPORT.

As a starter, copy the code created by IMPORT from the log and modify it.

Look what is in the file that causes the issues, and provide for it in the code. It might also be that you detect genuine faulty data that needs to be reported to the source.

 

For detailed help, provide an example of the csv file, including the header, "clean" data and a line that causes the ERROR.

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

You NEVER ignore ERRORs or WARNINGs, you correct them.

With CSV files, write the data step yourself instead of relying on the guesses of PROC IMPORT.

As a starter, copy the code created by IMPORT from the log and modify it.

Look what is in the file that causes the issues, and provide for it in the code. It might also be that you detect genuine faulty data that needs to be reported to the source.

 

For detailed help, provide an example of the csv file, including the header, "clean" data and a line that causes the ERROR.

ballardw
Super User

Show the entire LOG of anything generating errors. From the log copy the text of the code along with any notes, messages, warnings or errors. On the forum open a text box using the </> above the message window. PASTE the text.

 

It is much easier to make suggestions to code if we can copy and edit text.

 

You show nothing related to any specific variables, datetime or otherwise. So why are you referencing them?

 

If you have invalid data in the column for them I would expect to see different output in the log, such as INVALID data notes. Generally that means your data has values that are not valid datetime (or date or time) values but would not result in the type of error you show.

DanielDor
Obsidian | Level 7

Hi all,

Thanks to your advise, this was solved! This is the process i've done:
1. I've ran proc IMPORT CSV --> Got Error
2. I've copied the Data Step from the log
3. I've changed all the problematic fields to be characters
4. I've ran the data step to successfuly create a SAS Dataset
5. I've then did some modification to the problematic columns with compress function

Your help is much appreciated!

D

Kurt_Bremser
Super User

If you have columns in there that contain dates, times, datetimes or any other kind of numeric data, then do not read them as character, or only read them as character if the conversion to numeric takes more action than a custom informat can do.

You can't use character variables in calculations.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 1031 views
  • 2 likes
  • 3 in conversation