DATA Step, Macro, Functions and more

USING DDE Excel with Macro Variable

Reply
Frequent Contributor
Posts: 138

USING DDE Excel with Macro Variable


Hi,

Please see if someone can help:-

When i am running following program it is running fine:-

 

filename example1 dde 'excel|System';

data _null_;

set load_time2;

file example1;

if ((final_delay)='No Delays') then do;

put '[select("R11C23")]';

put '[patterns(1,,6,true)]'; /* color it red */

end;

run;

However when i am trying  to use macro variable for Row  It is giveing me SAS DDE Error.

filename example1 dde 'excel|System';

data _null_;

set load_time2;

file example1;

if ((final_delay)='No Delays') then do;

put '[select("R&part.C23")]';

put '[patterns(1,,6,true)]'; /* color it red */

end;

run;

Please assist

Super Contributor
Posts: 282

Re: USING DDE Excel with Macro Variable

Hi,

Assuming you have set up the macro variable with the required value, I suspect it is not resolving because of the single quotes that surround the put string.

Try using:

put '[select("R' "&part" 'C23")]';

Regards,

Amir.

Frequent Contributor
Posts: 138

Re: USING DDE Excel with Macro Variable

Hi Amir,

Macro is resolving same as we required. However i suspect there might be some conflict netween DDE and MAcro engine.

Anybody can help?

PROC Star
Posts: 7,363

Re: USING DDE Excel with Macro Variable

manojinpec: You never posted the code showing how you are creating the macro variable &part.  Your original code wouldn't have resolved correctly, anyhow, but Amir's solution did work if the macro variable had been created correctly.  Did you test it using the mlogic symbolgen and mprint options?

I took dde out of the equation and ran the following to see if you were creating what you expected to create.  You might want to try to do the same with your current code:

data load_time2;

  informat final_delay $20.;

  input final_delay &;

  cards;

Some Delays

No Delay

No Delays

Lots of Delays

;

%let part=11;

data _null_;

  set load_time2;

  file "c:\testdde.txt";;

  if ((final_delay)='No Delays') then do;

    put '[select("R' "&part" 'C23")]';

    put '[patterns(1,,6,true)]'; /* color it red */

  end;

run;

Ask a Question
Discussion stats
  • 3 replies
  • 361 views
  • 0 likes
  • 3 in conversation