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;
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.
@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.
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!
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.
Ready to level-up your skills? Choose your own adventure.