10-03-2011 11:20 AM
I'm running a fairly simple macro to import multiple sheets from an excel file into SAS. The problem is that in the DATA STEP the datafile ends up with a reverse slash, so that the DATAFiLE line reads:
DATAFILE= "O:\PROJ_LIB\Insurance\Schedule D Part34/2007_2009 Life SchDpt3.xls"
%DO i = 1 %to 6;
PROC IMPORT OUT=schd.LIFE_SchDpt4_2007_2009sheet&i.
DATAFILE= "O:\PROJ_LIB\Insurance\Schedule D Part34\2007_2009 Life SchDpt3.xls"
Does anyone have any idea why I keep getting a forward slash instead of the backslash that I put into my code?
10-03-2011 11:53 AM
No, I get a SAS error similar to this:
Requested Sheet Name not found on Excel -> C:\Users\g1axp03\Documents\My SAS Files\My SAS
Requested Input File Is Invalid
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 8.31 seconds
cpu time 4.91 seconds
SAS can't recognize the file, because the forward slash is not in the filename.
I've tried some basic troubleshooting. Resetting SAS, changing the file location and changing the file name.
10-03-2011 11:58 AM
I have always found that SAS ignores the directionality of the slashes (i.e., works well regardless if one uses back slashes, forward slashes, or a combination of them).
However, in your example the input file was on drive O:, but you indicate that it returned a message regarding drive c: .. and in a typical user path rather than the path you had specified.
Could it be that it simply can't find the file in the path that you specified?