BookmarkSubscribeRSS Feed
deleted_user
Not applicable
When I tried to import a .csv file with many variables using PROC IMPORT, the log window shows Invalid Data for one variable. Is this a format/informat problem? How can I address the issue by successfully importing the data? Can I delete the variable somewhere before I import it to SAS? I really don't want to delete the variable though. This is a very big dataset and I doubt that Excel can handle it.

I changed the default setting about how many records will be read before the procedure decides on the data format, but not sure if it'll work since I'm still waiting for the datasets to be read.
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
It should be quite clear from the SAS log about what input record (SAS diagnostic variable _N_) and so you can review your input file to validate the input as either NUMERIC or CHARACTER.

Also, the SAS log will indicate the SAS-generated code with the INPUT statement and INFORMAT used for each field.

Scott Barry
SBBWorks, Inc.
ballardw
Super User
While Proc Import can be very useful it does have limitations when the data isn't especially well formed. For example many types of ID fields such as product 'numbers' or ZIP codes may have mostly values that may be interpretted as numerics but have exceptions. The program will look at a number of lines to try to guess whether a variable should be string or numeric but may not look far enough if you have large data sets.

I would recommend running proc import and then looking at the generated code in the log. If any of the variables are numeric, informat is $xx., then copy the code out of the log into the editor and change the informat, format and input statements for that variable.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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