Search code examples
importsas

Stopping SAS adding = to the end of file paths


I have an issue where INFILE and PROC IMPORT are not working because the log shows that SAS is adding an = sign to the file path that I never specified.

Proc import out =  sasuser.tabdelim
datafile= “C:\Users\shaworth2\Documents\tabedelim.txt”
Dbms=tab replace;
getnames = YES
Run;

and the log is showing this error

NOTE: The SAS System stopped processing this step because of errors.
260  Proc import out =  sasuser.tabdelim
261  datafile= “C:\Users\shaworth2\Documents\tabedelim.txt=”
               -
               22
               76
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string.

ERROR 76-322: Syntax error, statement will be ignored.

262  Dbms=tab replace;
263  getnames = YES
264  Run;

Does anyone have any advice on how I can stop SAS thinking that there is a = at the end of my datafile path, please? is there a command or function to force an end of a string?

I really appreciate any help that I can get on this matter


Solution

  • Your syntax is correct. The problem is that your quotation marks are not correct. You are using right and left quotation marks when you should be using straight quotation marks, "

    U+201C:  “  Left Double Quotation Mark  - 226 128 156
    U+201D:  ”  Right Double Quotation Mark - 226 128 157   
    U+0022:  "  Straight Quotation Mark     - 034
    

    This usually happens when you copy/paste something from Word.

    Remove the left/right quotes and replace them with ", straight double quotation marks, by just pressing shift + quotation mark on your keyboard.