Good day.
I am having difficulty importing file into SAS Studio (full deployment)
Below is the code I used.
73 PROC IMPORT OUT= WORK.am
74 DATAFILE= "G:\My Drive\rush_cleaning\2012\accident.dbf.csv"
75 DBMS=CSV REPLACE;
76 RUN;
The error I get is as follows:
@oadeyemi wrote:
Thanks for replying.
You are right. I imported by clicking on the Import File.
Yes, I can see the codes.
However, I cannot see the dataset imported.
In SAS Studio, I should be able to see the imported table.
However, I cannot see that.
And when I use Proc Import using the code generated, there is an error.
I hope you understand my explanation.
I guess there might be a technical issue because I just installed SAS on the computer.
Thanks
Rerun the task. Go the log. Copy the data step generated, if any, and the messages including the error. Paste the log result into a code box opened with the forum's {I} or "running man" icon. The code box is important because it preserves formatting and some of the errors will show diagnostics as to the location in the code the error occurs. The main message windows will reformat the text moving those diagnostics. Plus it is harder to tell what was actually in the log and what comments you may be typing in the middle.
I see a number of concerns. Since you are referencing a file named "G:\My Drive\rush_cleaning\2012\accident.dbf.csv" it appears as if the file originated as a DBF file, and possibly was converted to CSV. Depending on the process used you may not actually have a CSV file or the conversion "corrupted' the file.
I am also a bit cautious when I see something like :
I found the "import" tab and I selected the excel file from the folders.
Most of the time when I use the wizards "CSV" files are not Listed as Excel but as "Comma Separated Values". So if you use an "Excel" format to import an actual CSV then likely there is a type mismatch, which is why we need to see the actual log of the code.
And if you did start with a DBF file you might be able to import that directly without conversion to CSV. Use the import Wizard and look for the "dBase File" entry.
If you do use proc import on a CSV, or other delimited, file I strongly recommend always setting the guessingrows option to MAX or the number of lines in the file so more records are examined before SAS assigns variable characteristics like type, length, informat and format.
Thank you for the help.
I found the "import" tab and I selected the excel file from the folders.
There was no error but I cannot see the sheet I imported.
How can I view this sheet?
Thank you for your input.
I am not using GUI or coding.
I am using SAS Studio from a SAS package that has all the gamut of SAS tools (9.4, Enterprise, Studio etc.)
It is installed on my hard drive.
Yes I imported using the "point and click" and the proc import codes.
No information in the library.
I guess it is a technical issue.
Thanks
Hello,
If you have used the Import data task, then you can see the code generated by SAS. Your actual physical path can be found there for future reference.
Thanks for replying.
You are right. I imported by clicking on the Import File.
Yes, I can see the codes.
However, I cannot see the dataset imported.
In SAS Studio, I should be able to see the imported table.
However, I cannot see that.
And when I use Proc Import using the code generated, there is an error.
I hope you understand my explanation.
I guess there might be a technical issue because I just installed SAS on the computer.
Thanks
And when I use Proc Import using the code generated, there is an error.
I hope you understand my explanation.
Post the error then. You will not see a table/output if the process errors out because no output is often created.
@oadeyemi wrote:
Thanks for replying.
You are right. I imported by clicking on the Import File.
Yes, I can see the codes.
However, I cannot see the dataset imported.
In SAS Studio, I should be able to see the imported table.
However, I cannot see that.
And when I use Proc Import using the code generated, there is an error.
I hope you understand my explanation.
I guess there might be a technical issue because I just installed SAS on the computer.
Thanks
Rerun the task. Go the log. Copy the data step generated, if any, and the messages including the error. Paste the log result into a code box opened with the forum's {I} or "running man" icon. The code box is important because it preserves formatting and some of the errors will show diagnostics as to the location in the code the error occurs. The main message windows will reformat the text moving those diagnostics. Plus it is harder to tell what was actually in the log and what comments you may be typing in the middle.
I see a number of concerns. Since you are referencing a file named "G:\My Drive\rush_cleaning\2012\accident.dbf.csv" it appears as if the file originated as a DBF file, and possibly was converted to CSV. Depending on the process used you may not actually have a CSV file or the conversion "corrupted' the file.
I am also a bit cautious when I see something like :
I found the "import" tab and I selected the excel file from the folders.
Most of the time when I use the wizards "CSV" files are not Listed as Excel but as "Comma Separated Values". So if you use an "Excel" format to import an actual CSV then likely there is a type mismatch, which is why we need to see the actual log of the code.
And if you did start with a DBF file you might be able to import that directly without conversion to CSV. Use the import Wizard and look for the "dBase File" entry.
If you do use proc import on a CSV, or other delimited, file I strongly recommend always setting the guessingrows option to MAX or the number of lines in the file so more records are examined before SAS assigns variable characteristics like type, length, informat and format.
Thank you so much.
The extension of the document was the problem.
I kept assuming it was a CSV but it was saved as an excel document (converted from dbf to excel)
Thank you for the steps you suggested.
It is resolved.
Thank you
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.