From: Ruby on
Hi SAS experts,

I am trying to export the summary results to excel and create each
table names based on plan names. However, I am having trouble creating
table names with SHEET= statement in proc export step. The main sas
structure has been illustrated here. Any help are very appreciated.
Thank you!

%macro denied;
proc sql noprint;
select distinct plancode into: plan1 - : plan&sysmaxlong
from enc.claims_cfy2009;
quit;
%let nVars=&sqlobs;

%do i=1 %to &nVars;
/*** omit some data processing steps ***/
proc export data=result outfile="C:\summary.xls" replace DBMS=excel;
sheet="symget('plan'||cats(put(&i,2.)))"; /*** here is the problem
***/
run;
%end;
%mend;

%denied;


From: Arthur Tabachneck on
Ruby,

I'm not at a computer where I can run SAS, so I'll have to do the next
best thing, namely lead you to a page that shows an example of what
you are trying to do. Take a look at:
http://www.sascommunity.org/wiki/Automatically_Separating_Data_into_Excel_Sheets

HTH,
Art
--------------
On Jun 18, 4:59 pm, Ruby <windof...(a)gmail.com> wrote:
> Hi SAS experts,
>
> I am trying to export the summary results to excel and create each
> table names based on plan names. However, I am having trouble creating
> table names with SHEET= statement in proc export step. The main sas
> structure has been illustrated here. Any help are very appreciated.
> Thank you!
>
> %macro denied;
> proc sql noprint;
> select distinct plancode into: plan1 - : plan&sysmaxlong
> from enc.claims_cfy2009;
> quit;
> %let nVars=&sqlobs;
>
> %do i=1 %to &nVars;
> /*** omit some data processing steps ***/
> proc export data=result outfile="C:\summary.xls" replace DBMS=excel;
> sheet="symget('plan'||cats(put(&i,2.)))"; /*** here is the problem
> ***/
> run;
> %end;
> %mend;
>
> %denied;

From: Ruby on
Thank you very much! That is exactly what I am looking for.