Hi,
My below code taking 211 CPU seconds in Mainframes.I have 8 code snippets similar to below code, that needs to be run daily? any idea how can i optimize them??
ODS TAGSETS.EXCELXP BODY=HTML1
OPTIONS(SHEET_NAME='123');
PROC PRINT DATA=ABC
WHERE REGION IN ('123');
VAR var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11 var12;
FORMAT var3 var4 MMDDYY10.;
RUN;
ODS TAGSETS.EXCELXP
OPTIONS(SHEET_NAME='456');
PROC PRINT DATA=DEF
WHERE REGION IN ('456');
VAR var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11 var12;
FORMAT var3 var4 MMDDYY10.;
RUN;
ODS TAGSETS.EXCELXP CLOSE;
ODS LISTING;
And each proc print gives more that 100K observations, that variables that are included VAR condition are always same, but the data i read from is different, ABC in 1st and DEF in 2nd.
Thank you.
The only thing I can think to fast it is using Data Step + Put to instead of proc print .
And why not try proc export or libname + excel engine to get it . If you don't care about the style .
Why would you print 100k obs?
Don't know if tagsets eats more CPU than other export techniques, try proc export/data step put and compare.
Indexing on Region might help depending on the ratio selected rows from source table.
I've found that using ODS on large files is slow and uses lots of resources. If resources are an issue I would use PROC Export to get the data to Excel.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.