BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Alexxxxxxx
Pyrite | Level 9

Dear all,

 

How can I overcome the 'WARNING: Apparent symbolic reference D not resolved.'?

 

when I using the following code to clean a company name dataset,

 

%MACRO CompnayNameM(no=,Company_name=);

Data Step3.Datastream_gb_Step8;
Set Step3.Datastream_gb_Step8;
&Company_name._Step8=&Company_name._Step6;
&Company_name._Step8= tranwrd(&Company_name._Step8," A B "," AB ");
&Company_name._Step8= tranwrd(&Company_name._Step8," A CALIFORNIA CORP "," CORP ");
&Company_name._Step8= tranwrd(&Company_name._Step8," A DELAWARE CORP "," CORP ");
&Company_name._Step8= tranwrd(&Company_name._Step8," AKTIEBOLAGET "," AB ");
&Company_name._Step8= tranwrd(&Company_name._Step8," AKTIEBOLAG "," AB ");
&Company_name._Step8= tranwrd(&Company_name._Step8," ACADEMY "," ACAD ");
&Company_name._Step8= tranwrd(&Company_name._Step8," ACTIEN GESELLSCHAFT "," AG ");
&Company_name._Step8= tranwrd(&Company_name._Step8," ACTIENGESELLSCHAFT "," AG ");
&Company_name._Step8= tranwrd(&Company_name._Step8," AKTIEN GESELLSCHAFT "," AG ");
&Company_name._Step8= tranwrd(&Company_name._Step8," AKTIENGESELLSCHAFT "," AG ");


...



&Company_name._Step8=tranwrd(&Company_name._Step8, " RES & DEV ", " R&D ");
&Company_name._Step8=tranwrd(&Company_name._Step8, " RECH & DEV ", " R&D ");
chflag&Company_name.6vs8=(&Company_name._Step8 ne &Company_name._Step6);
run;

data watch&no. (keep=&Company_name. &Company_name._Step6 &Company_name._Step8 GEOGRAPHIC_DESCR_ chflag&Company_name.6vs8);
set Step3.Datastream_gb_Step8;
if chflag&Company_name.6vs8=1;
run;

%MEND CompnayNameM;

%CompnayNameM(no=1,Company_name=NAME)
%CompnayNameM(no=2,Company_name=COMPANY_NAME)
%CompnayNameM(no=3,Company_name=COMPANY_NAME_1)
%CompnayNameM(no=4,Company_name=COMPANY_NAME___SHORT)
%CompnayNameM(no=5,Company_name=PREVIOUS_NAME)
run;

However, 

I get 

 

1924  data watch&no. (keep=&Company_name. &Company_name._Step6 &Company_name._Step8 GEOGRAPHIC_DESCR_
1924! chflag&Company_name.6vs8);
1925  set Step3.Datastream_gb_Step8;
1926  if chflag&Company_name.6vs8=1;
1927  run;
1928
1929  %MEND CompnayNameM;
1930
1931  %CompnayNameM(no=1,Company_name=NAME)
WARNING: Apparent symbolic reference D not resolved.
WARNING: Apparent symbolic reference D not resolved.

NOTE: There were 11846 observations read from the data set STEP3.DATASTREAM_GB_STEP8.
NOTE: The data set STEP3.DATASTREAM_GB_STEP8 has 11846 observations and 63 variables.
NOTE: DATA statement used (Total process time):
      real time           36.04 seconds
      cpu time            11.14 seconds



NOTE: There were 11846 observations read from the data set STEP3.DATASTREAM_GB_STEP8.
NOTE: The data set WORK.WATCH1 has 566 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           11.63 seconds
      cpu time            0.61 seconds


1932  %CompnayNameM(no=2,Company_name=COMPANY_NAME)
WARNING: Apparent symbolic reference D not resolved.
WARNING: Apparent symbolic reference D not resolved.

NOTE: There were 11846 observations read from the data set STEP3.DATASTREAM_GB_STEP8.
NOTE: The data set STEP3.DATASTREAM_GB_STEP8 has 11846 observations and 65 variables.
NOTE: DATA statement used (Total process time):
      real time           36.76 seconds
      cpu time            12.10 seconds



NOTE: There were 11846 observations read from the data set STEP3.DATASTREAM_GB_STEP8.
NOTE: The data set WORK.WATCH2 has 1659 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           12.71 seconds
      cpu time            0.70 seconds

Do you know why? and how can I fix it?

thanks for your attention to this matter.

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

Change code like this: " R&D " to ' R&D ' to stop SAS thinking &D is a macro reference.

View solution in original post

1 REPLY 1
SASKiwi
PROC Star

Change code like this: " R&D " to ' R&D ' to stop SAS thinking &D is a macro reference.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2944 views
  • 1 like
  • 2 in conversation