BookmarkSubscribeRSS Feed
Sandeep77
Lapis Lazuli | Level 10

Hi all,

I am importing a CSV file from a location to SAS. When I am importing the data is imported and I can see the output results as normal but in the log it shows an error as Import unsuccessful. Can you please suggest the error that I am doing in importing the file?

Proc import 
datafile='\\lowell2.local\shares\Public\Trace\Trace Integrity Analyst Data\BAU_Processes\SAS\Enhanced TPT\Files To Send\EQ_Trace_2023_02_10_10FEB2023.CSV'
out=Feb_release
dbms=csv
replace;
run;

Log:
     

Errors detected in submitted DATA step. Examine log.
995394 rows created in WORK.FEB_RELEASE from \\lowell2.local\shares\Public\Trace\Trace Integrity Analyst 
Data\BAU_Processes\SAS\Enhanced TPT\Files To Send\EQ_Trace_2023_02_10_10FEB2023.CSV.
  
  
  
ERROR: Import unsuccessful.  See SAS Log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           2.60 seconds
      user cpu time       1.48 seconds
      system cpu time     0.07 seconds
      memory              8646.65k
      OS Memory           39020.00k
      Timestamp           03/23/2023 09:01:20 AM
      Step Count                        60  Switch Count  11
      
10 REPLIES 10
yabwon
Onyx | Level 15

You are showing proc import code, and the log says:

Errors detected in submitted DATA step.

I think it is not all the log information you are sharing. 

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Kurt_Bremser
Super User

Never use PROC IMPORT for text files. Write the DATA step yourself, according to the documentation of the csv file. Guarantees consistent and correct results, which the guessing of PROC IMPORT can't.

Sandeep77
Lapis Lazuli | Level 10

I used the data step to import the file as you suggested and it ran without any errors but the dataset is blank. It is showing only the number of rows but no data in the dataset.

data EQ_Trace_2023_02_10_10FEB2023; 
infile '\\lowell2.local\shares\Public\Trace\Trace Integrity Analyst Data\BAU_Processes\SAS\Enhanced TPT\Storage\Monthly Washes\Trace_2023_02_10\elnz_Lowell_10Feb.CSV';
input ;
run;
Log:
1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program';
4          %LET _CLIENTPROCESSFLOWNAME='Process Flow';
5          %LET _CLIENTPROJECTPATH='S:\Trace\Trace Integrity Analyst Data\Projects and Tasks\3. Sandeep\Equifax released.egp';
6          %LET _CLIENTPROJECTPATHHOST='LWLT5CG9322XFL';
7          %LET _CLIENTPROJECTNAME='Equifax released.egp';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=SVG;
13         GOPTIONS XPIXELS=0 YPIXELS=0;
14         %macro HTML5AccessibleGraphSupported;
15             %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) >= 0 %then ACCESSIBLE_GRAPH;
16         %mend;
17         ODS LISTING GPATH=&sasworklocation;
18         FILENAME EGHTML TEMP;
19         ODS HTML5(ID=EGHTML) FILE=EGHTML
20             OPTIONS(BITMAP_MODE='INLINE')
21             %HTML5AccessibleGraphSupported
22             ENCODING='utf-8'
23             STYLE=HTMLBlue
24             NOGTITLE
25             NOGFOOTNOTE
26             GPATH=&sasworklocation
27         ;
NOTE: Writing HTML5(EGHTML) Body file: EGHTML
28         
29         data EQ_Trace_2023_02_10_10FEB2023;
30         infile '\\lowell2.local\shares\Public\Trace\Trace Integrity Analyst Data\BAU_Processes\SAS\Enhanced TPT\Storage\Monthly
30       ! Washes\Trace_2023_02_10\elnz_Lowell_10Feb.CSV';
31         input ;
32         run;

NOTE: Compression was disabled for data set WORK.EQ_TRACE_2023_02_10_10FEB2023 because compression overhead would increase the size 
      of the data set.
NOTE: The infile '\\lowell2.local\shares\Public\Trace\Trace Integrity Analyst Data\BAU_Processes\SAS\Enhanced TPT\Storage\Monthly 
      Washes\Trace_2023_02_10\elnz_Lowell_10Feb.CSV' is:
      
      Filename=\\lowell2.local\shares\Public\Trace\Trace Integrity Analyst Data\BAU_Processes\SAS\Enhanced TPT\Storage\Monthly 
      Washes\Trace_2023_02_10\elnz_Lowell_10Feb.CSV,
      RECFM=V,LRECL=32767,
      File Size (bytes)=263495880,
      Last Modified=15Feb2023:10:23:24,
      Create Time=15Feb2023:10:27:08

NOTE: 995395 records were read from the infile '\\lowell2.local\shares\Public\Trace\Trace Integrity Analyst 
      Data\BAU_Processes\SAS\Enhanced TPT\Storage\Monthly Washes\Trace_2023_02_10\elnz_Lowell_10Feb.CSV'.
      The minimum record length was 114.
      The maximum record length was 1345.
NOTE: The data set WORK.EQ_TRACE_2023_02_10_10FEB2023 has 995395 observations and 0 variables.
NOTE: DATA statement used (Total process time):
      real time           1.34 seconds
      user cpu time       0.48 seconds
      system cpu time     0.06 seconds
      memory              749.06k
      OS Memory           35428.00k
2                                                          The SAS System                            10:50 Wednesday, March 22, 2023

      Timestamp           03/23/2023 10:07:12 AM
      Step Count                        72  Switch Count  2
      

33         
34         %LET _CLIENTTASKLABEL=;
35         %LET _CLIENTPROCESSFLOWNAME=;
36         %LET _CLIENTPROJECTPATH=;
37         %LET _CLIENTPROJECTPATHHOST=;
38         %LET _CLIENTPROJECTNAME=;
39         %LET _SASPROGRAMFILE=;
40         %LET _SASPROGRAMFILEHOST=;
41         
42         ;*';*";*/;quit;run;
43         ODS _ALL_ CLOSE;
44         
45         
46         QUIT; RUN;
47         
Kurt_Bremser
Super User

With an empty INPUT statement, no variables will be created/populated.

 

You MUST (as I already said) write the DATA step according to the documentation of the file, where all variables and their attributes will be described.

If you did not receive documentation, return to sender, or pay a visit to them wielding a suitable instrument, like a baseball bat.

 

In case some pumpkin sent you the file without doc, we might be able to make some educated guesses when we see the file's contents. Open it with a text editor (NOT with Excel!!!) and copy/paste the first few lines into a window opened with this button:

Bildschirmfoto 2020-04-07 um 08.32.59.jpg

Kirito1
Quartz | Level 8

Try importing the data with the infile method. As below code.

DATA DWH4;
INFILE 'address of the file with its extension like (.csv)'
missover
dsd
firstobs=2;
/* $ = here represents the length of the data8/
/*for example a mobile number has should be of length 10 then it would be $10.*/
informat 'column1 name'n $100.;
informat 'column2 name'n $100.;


format 'column1 name'n $100.;
format 'column2 name'n $100.;


input

'Column1 name'n $
'Column2 name'n $;
run;

It gives us more flexibility. Although, Importing is the best procedure but it sometimes creates problem. So what I did is to use infile method for a very large data.

Ksharp
Super User
/*
Try guessingrows=max and getnames=no options
*/
Proc import
datafile='\\lowell2.local\shares\Public\Trace\Trace Integrity Analyst Data\BAU_Processes\SAS\Enhanced TPT\Files To Send\EQ_Trace_2023_02_10_10FEB2023.CSV'
out=Feb_release
dbms=csv
replace;
guessingrows=max;
getnames=no ;
run;
Sandeep77
Lapis Lazuli | Level 10
The code ran successfully but it only pulled out 11 columns out of 72 and all the column headers were changed to VAR1, VAR2... to VAR11.
Ksharp
Super User
So I suggested you post some your real data(not all) to test your code and find out where is problem.
ballardw
Super User

Copy the first 5 lines from the file. Open your file with a TEXT EDITOR to copy the text. On the forum open a text box with the </> and paste the result.

 

IF the content is sensitive AFTER pasting into the text box type over sensitive values with XXX (character) or 000 (numeric).

 

One suspects the file is not actually a simple CSV.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 10 replies
  • 1714 views
  • 3 likes
  • 6 in conversation