BookmarkSubscribeRSS Feed
sasuser_sk
Quartz | Level 8

I have below code to run proc export that successfully sends my workbook to server and from server to local drive by Copy file. Then I have proc tabulate and I want to add the results from proc tabulate to the same workbook. Can anyone please make suggestions on how I can get the desired result. For proc tabulate sheet I want to name it as " Act Summary".

 

%let F_Name = Business Report;

%let folderloc = /sasdata/exports/;

%let Todays_Date = %SYSFUNC(DATE(), date9.);

%let Full_F_Name = &folderloc.&F_Name._&Todays_Date..xlsx;

%let backup = "&Full_F_Name..bak";

proc export data=WORK.Acts                                                                            

outfile= "&Full_F_Name."

  dbms=xlsx

  replace;

  Sheet= "ActDetails";run;                                                                                                                                   

proc export data=WORK.Gross                                                                            

outfile= "&Full_F_Name."

  dbms=xlsx

  replace;

  Sheet= "GrossDetails";run

 

 

PROC TABULATE

DATA=WORK.Acts;

     VAR SRVC_ID;

     CLASS "Highest"n /     ORDER=UNFORMATTED MISSING;

     CLASS "Act Month"n /  ORDER=UNFORMATTED MISSING;

     TABLE /* Row Dimension */

'Highest'n

ALL={LABEL="Total (ALL)"},

/* Column Dimension */

'Act Month'n*  N*  SRVC_ID

ALL={LABEL="Total (ALL)"}* N;;

RUN;

4 REPLIES 4
Reeza
Super User
If you change your two proc exports to a proc print instead you can use ODS EXCEL.

ods excel file='/home/fkhurshed/demo/&full_f_name..xlsx" options(sheet_interval='proc');
proc print data=acts;
run;

proc print data=gross;
run;

proc tabulate .....

....run;

ods excel close;

sasuser_sk
Quartz | Level 8

I tried your suggestion and it gave me insufficient memory issue. I tried using proc options option=memsize; run; quit; but that didn't help either.

Reeza
Super User
Does your proc tabulate run? If not, that's an entirely different issue.

Show your full code and log please.
ballardw
Super User

@sasuser_sk wrote:

I have below code to run proc export that successfully sends my workbook to server and from server to local drive by Copy file. Then I have proc tabulate and I want to add the results from proc tabulate to the same workbook. Can anyone please make suggestions on how I can get the desired result. For proc tabulate sheet I want to name it as " Act Summary".

 

%let F_Name = Business Report;

%let folderloc = /sasdata/exports/;

%let Todays_Date = %SYSFUNC(DATE(), date9.);

%let Full_F_Name = &folderloc.&F_Name._&Todays_Date..xlsx;

%let backup = "&Full_F_Name..bak";

proc export data=WORK.Acts                                                                            

outfile= "&Full_F_Name."

  dbms=xlsx

  replace;

  Sheet= "ActDetails";run;                                                                                                                                   

proc export data=WORK.Gross                                                                            

outfile= "&Full_F_Name."

  dbms=xlsx

  replace;

  Sheet= "GrossDetails";run

 

 

PROC TABULATE

DATA=WORK.Acts;

     VAR SRVC_ID;

     CLASS "Highest"n /     ORDER=UNFORMATTED MISSING;

     CLASS "Act Month"n /  ORDER=UNFORMATTED MISSING;

     TABLE /* Row Dimension */

'Highest'n

ALL={LABEL="Total (ALL)"},

/* Column Dimension */

'Act Month'n*  N*  SRVC_ID

ALL={LABEL="Total (ALL)"}* N;;

RUN;


When you use code like this the second output overwrites the first

proc export data=WORK.Acts                                                                            
outfile= "&Full_F_Name."
  dbms=xlsx
  replace;
  Sheet= "ActDetails";run;                                                                                                                                   

proc export data=WORK.Gross                                                                            
outfile= "&Full_F_Name."

You used the same name for both outputs.

 

If you have both the ODS Excel and ODS Html destinations open at the same time then you are duplicating the output and large report tables may use up all the memory. You may need to have ODS HTML close; before generating the output.

If you still have issues with memory you may have to redesign the table to fit available memory.

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
  • 4 replies
  • 390 views
  • 0 likes
  • 3 in conversation