BookmarkSubscribeRSS Feed
Subbarao
Fluorite | Level 6

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.

3 REPLIES 3
Ksharp
Super User

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 .

LinusH
Tourmaline | Level 20

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.

Data never sleeps
SASKiwi
PROC Star

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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