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

Below is my code.

In file_a, there are 99 columnswith over 100K rows.

There is one column in this file that has either numeric or alpha data (not alpha-numeric) for each entry.  The format for this column in DATAROW=2 is numeric.  When I run this file, SAS thinks the column is numeric.  If it comes to a cell with ALPHA, it returns "." for missing.

How can I fix the code - without having to list EVERY INFORMAT, FORMAT and INPUT for all 99 variables?

Thanks!

********************************

PROC IMPORT OUT=LIBNAME.file_b

DATAFILE = 'file_a'

DBMS=CSV replace;

GETNAME=YES;

DATAROW=2;

RUN;

1 ACCEPTED SOLUTION

Accepted Solutions
Doc_Duke
Rhodochrosite | Level 12

You also might be able to address this using the GUESSINGROWS statement in PROC IMPORT.

View solution in original post

5 REPLIES 5
Reeza
Super User

I think it might be DBTYPE option, see the documentation...

SAS/ACCESS(R) 9.2 Interface to PC Files: Reference, Second Edition

Doc_Duke
Rhodochrosite | Level 12

You also might be able to address this using the GUESSINGROWS statement in PROC IMPORT.

jen123
Fluorite | Level 6

I didn't know how to use DBTYPE with PROC IMPORT.

I tried GUESSINGROWS with PROC IMPORT.  The results look like they match the input file - # of rows in dataset matches .csv file.  However, I got an error:

 

NOTE: Invalid data for Glob_Function_Id in line 94102 839-842.

 

Errors detected in submitted DATA step. Examine log.

108956 rows created in libname.file_b from file_a.csv.

 

ERROR: Import unsuccessful. See SAS Log for details.

I got many of the NOTE in the log.  I checked the line and everything looks good.  Any thoughts as to the error?  What do the numbers 839-842 mean?

Thanks!!!

Doc_Duke
Rhodochrosite | Level 12

839-842 are the columns for the variable that SAS had trouble reading.

jen123
Fluorite | Level 6

I thought they refer to columns, but my file has 99 columns (variables).  So that confused me.

Anyway, I checked the entire row and everything matched with the original file.  So I am not sure what the error is.

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!

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