BookmarkSubscribeRSS Feed
darrenhoggard
Calcite | Level 5

Hi

I am importing an XLSX file using the proc import code:

PROC IMPORT OUT= &outDS.
DATAFILE= "&inFile."
DBMS=xlsx REPLACE;
range="&sheetNM.$A1:AZ";
GETNAMES=YES;
RUN;

 

However, some of the date columns have no data in them, but when SAS is importing it, it is populating the field with the value from the previous line:

REF1Start DateEnd Date
ABC12315-May-1517-Aug-18
ABC23411-Jun-1817-Aug-18
ABC34514-Dec-1517-Aug-18
ABC45617-Feb-1717-Aug-18
ABC56706-Mar-1517-Aug-18
ABC89810-Mar-1517-Aug-18

 

Only the first row should have the end date as 17/08/2018, all the others are blank in the original date.

 

How is this fixed.

D

3 REPLIES 3
Reeza
Super User
Is the cell merged? Can you attach a sample of the Excel file? I've never seen this occur so very curious under what circumstances it would occur.
darrenhoggard
Calcite | Level 5

hi,

 

I think it is something in excel.

 

the file is received from a third party, when I amended some of the data and saved as a new workbook, it was imported into SAS ok.

 

I will have to go back to the third party and see what they are doing!

 

thnaks

Kurt_Bremser
Super User

Bottom line: it is foolish to expect consistent, usable results from Excel files.

Save the data to a csv file, which you can inspect with a text editor, and read it with a data step written along the documentation you get with the file.

(no documentation -> return to sender)

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1749 views
  • 0 likes
  • 3 in conversation