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;
|
|
0
|
|
|
|
Reply
|
windofoct (20)
|
6/18/2010 8:59:44 PM |
|
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_S=
heets
HTH,
Art
--------------
On Jun 18, 4:59=A0pm, Ruby <windof...@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=3D 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=3D&sqlobs;
>
> %do i=3D1 %to &nVars;
> /*** omit some data processing steps ***/
> proc export data=3Dresult outfile=3D"C:\summary.xls" replace DBMS=3Dexcel=
;
> sheet=3D"symget('plan'||cats(put(&i,2.)))"; /*** here is the problem
> ***/
> run;
> %end;
> %mend;
>
> %denied;
|
|
0
|
|
|
|
Reply
|
Arthur
|
6/19/2010 9:48:51 PM
|
|
Thank you very much! That is exactly what I am looking for.
|
|
0
|
|
|
|
Reply
|
Ruby
|
6/21/2010 2:02:16 PM
|
|