BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

I have a csv file within a share drive with an &

%LET MTG = \\p1l-nas-02.dlnet.com\mort\SS&A Folder\mortgage

When I run the code it says WARNING: Apparent symbolic reference A not resolved

I renamed this way

%LET MTG = \\p1l-nas-02.dlnet.com\mort\SS(&)A Folder\mortgage

I do not get the error when I add (&) however when I run the following code

proc import 
datafile="&MTG.\REPORT.CSV"
out=REPORT  
dbms=EXCELCS replace; /*EXCELCS*/
server="sas-pcff.mortg-prd.com"; 
port=9922 ;
SERVERUSER="&suserid."; SERVERPASS="&mypass.";
run;

I get the error It does not exist or it is already opened exclusively by another user, or you need permission
I am thinking that I am not actually reading in the sharedrive.  I do not know why the user name the sharedrive with an '&' however is there a fix so I can read in the file??

7 REPLIES 7
Tom
Super User Tom
Super User

Try adding macro quoting.

For your original path you could try just adding it when defining it.

%LET MTG = \\p1l-nas-02.dlnet.com\mort\SS%str(&)A Folder\mortgage;

For the second try adding it in the call to PROC IMPORT.

datafile="%superq(MTG)\REPORT.CSV"

 

Q1983
Lapis Lazuli | Level 10
I used Excel because when I used CSV i received an error. Is that the correct reference in this case
ballardw
Super User

@Q1983 wrote:
I used Excel because when I used CSV i received an error. Is that the correct reference in this case

Show the code that you use with CSV with the error(s)

 

You may have to open the file, not with spreadsheet software, with a plain next editor like Notepad to see the actual contents to set the proper delimiter and options.

Tom
Super User Tom
Super User

I do not see anything in the documentation that says you can use the SAS PC Files Server to access CSV files.  Just Excel or Access files.  if the file is actually a CSV file then move it to a location that SAS can read directly.  Or use Excel to read the file and save it as an XLSX file and then try using PC Files Server to read the XLSX file.

Kurt_Bremser
Super User

One does not use PROC IMPORT for CSV files. Write the data step yourself, according to the file documentation, for consistent and controlled results. Or use PROC IMPORT only once, and copy the data step code from the log and correct/optimize it.

The PC Files server is only for Excel workbooks and MS Access (.mdb) files, and is only needed when you run SAS on a non-Windows platform where the Microsoft-supplied module for reading older MS Office files is not available. With the introduction of .xlsx and the (now internal to SAS) XLSX engine SAS can read such files on all supported platforms.

You have to store the file on the SAS server (upload facility in SAS Studio, or Copy Files task in Enterprise Guide) or on a shared network location which is also accessible (mounted) on the SAS server.

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 7 replies
  • 922 views
  • 2 likes
  • 4 in conversation