BookmarkSubscribeRSS Feed
Chip
Calcite | Level 5
I am attempting to open an Excel spreadsheet but because I have a single quote in the location, it's dying on me. Can I get around it? I've tried using a macro var in place of the network location but haven't had any success with that.

DATA _NULL_;
FILE CMDEXCEL;
PUT '[OPEN("N:\PUBLIC\Chip's Adhocs\ADHOCS 2006\balanced_scorecard\XLS\Balance Scoreard Data.xls")]';
RUN;
1 REPLY 1
ToddB
SAS Employee
Have you tried adding another ' changing Chip's to Chip''s?

5 DATA _NULL_;
6 FILE CMDEXCEL;
7 PUT '[OPEN("C:\Temp\Todd's Test\Book1.xls")]';
--------------------- -
49 22
---------
201
NOTE 49-169: The meaning of an identifier after a quoted string may change in a future SAS
release. Inserting white space between a quoted string and the succeeding
identifier is recommended.

ERROR 22-322: Syntax error, expecting one of the following: a name, an integer constant,
arrayname, #, $, &, (, +, -, /, //, :, ;, =, ?, @, @@, OVERPRINT, [, _ALL_,
_BLANKPAGE_, _ODS_, _PAGE_, {, ~.

ERROR 201-322: The option is not recognized and will be ignored.

8 RUN;
9
10 '"*;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 4.79 seconds
cpu time 0.01 seconds



11 DATA _NULL_;
12 FILE CMDEXCEL;
13 PUT '[OPEN("C:\Temp\Todd''s Test\Book1.xls")]';
14 RUN;

NOTE: The file CMDEXCEL is:
File Name=C:\Documents and Settings\sasshb\cmdexcel.dat,
RECFM=V,LRECL=256

NOTE: 1 record was written to the file CMDEXCEL.
The minimum record length was 39.
The maximum record length was 39.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time 0.00 seconds

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

Register now

Discussion stats
  • 1 reply
  • 1462 views
  • 0 likes
  • 2 in conversation