1
votes

I am trying to import a .csv file but there is special character like (&) in bp&d in the path, Its showing error as WARNING: Apparent symbolic reference D not resolved. how can I do it.

proc import datafile="\pa-storage\bp&d\fot\PRODUCTS\Daa-SQN\ATA\Pss10_ALL_IN_ALL.csv" out=test dbms=csv replace; getnames=yes; run;

3
It is a warning, not an error. Jeff's solution should make it go away; you can also just ignore it, if you choose (though it's better to make it go away). Only ERROR: specifically prevents something a datastep processing (though Warnings or even Notes may indicate a problem exists of course).Joe

3 Answers

6
votes

Use single quotes (') instead of double ("). SAS will then interpret the quoted path as a literal string without trying to resolve apparent macro variables (which always start with &) that it contains.

I prefer to use single quotes in general, and only employ double quotes when I explicitly want to include a macro variable.

1
votes

If you need double quotes for some reason (like there is an actual macro variable you want to resolve), you can use several methods to solve that. The simplest is to wrap the & in a %str().

%put Some &s here;

%put Some %str(&)s here;

You also can wrap a portion of the string (or all of it that you don't want to have macro variables) in %nrstr or any other macro quoting with nr init.

%put %nrstr(Some &s here);
0
votes

Try doing it on SAS Studio with this code.

  1. upload it to the SAS files and folder(desired folder) and then use this code=

    proc import datafile = '';

out = a

dbms = csv replace;

run;