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.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 583 views
  • 0 likes
  • 3 in conversation