You know I did have just one Macro initially ... but it would fail. But I think I had it set up incorrectly in some way (which I now forget!). But THANK YOU Reeza!!! You've been amazingly helpful and so kind with my slowly grasping the information you've provided. It's nice to re-grease my SAS wheels! I love your elegent rewrite of my macro, but it doesn't work ... running that code gives me the same error I was seeing last night - the text of the macro is written into the excel document rather than run as code. Weird I know. I think it has to do with timing (?) .. that is, the copy procedure is simply copying over the text of the macro ... rather than the macro getting to execute (if that makes sense). In any case, I re-did my Macro ... cleaning it up carefully, and used your tip of creating the _null_ dataset and a call execute to run multiples of IDs ... and voila! Got what I need ... with the testsets of 20 and 60 cases. So here's my working code now: %macro Tool(ID);
data tool1;
set testOxy ;
if sample_ID = "&id";
format From_Date To_Date Billed_Date mmddyy10.;
run;
options noxwait noxsync;
%sysexec copy "U:\SMRT\Med Review Tool Pilot\Oxy Review Tool\OxygenMRPilot0811_d2.xlsx"
"C:\testsas\Tests_0814\OxygenMRPilot_&ID..xlsx" ;
run;
%exportxl( data=tool1 ,
outfile= C:\testsas\Tests_0814\OxygenMRPilot_&ID..xlsx,
Sheet=SMRT,
Type=M,
Replace=N,
useformats=N);
run;
%MEND Tool;
Data _null_;
Set idlist;
Str = catt('%tool(', id, ');');
Call execute ( Str);
Run;
; Only one odd result ... there's a stack of cmd windows open .. expected .. and they each slowly close as the run gets completed. However, the final cmd window stays open till I manually close it. It doesn't seem to affect the results tho'
... View more