Hi, I have a SAS code, it used to run smoothly but now it's taking too much time, sometimes the it's not executing at all. I tried to forcefully close that program. What can I do?. Can anyone suggest me with proper steps?.
I agree that something probably changed. While this code is not perfect and is a bit crude, if you have a "suspect" part of your code, you can still used it to estimate clock time for those sections. Place the code in your existing program, with the "suspect" code between the data _null_ and run statements. After running, view the Elasped time value in the log. Repeat as needed, but you should restart SAS each time to clear all caches.
/*Here is a program to count elasped time*/
%let begintime = %sysfunc(time());
/*your code here*/
%let endtime = %sysfunc(time());
Format ElapsedTime time11.2;
ElapsedTime = &endtime - &begintime;
Does the log show you where steps are taking longer? That there are more observations involved?
Any warnings or notes about data problems in the log?
You may need to describe your environment a bit more. If you are accessing data over a network then you might have bandwidth issues. If pulling data from an external database then you may have performance issues if the providing system is busier than normal.
Also when I see "used to run smoothly" then I also ask "has something changed recently?" Check with your SAS admin or IT. All sorts of things have been known to cause issues. Like the time my IT department physically moved my network connection to an unconnected cable and it took three days for them to figure out what happened.
Any time a SAS program does not run as expected, the proper first step is to review your SAS log as already mentioned by @ballardw
Search the SAS log for any errors or warnings. If there are then you need to investigate them and fix them. If there are not and it is just a problem of slow performance then find the slowest steps in your program. Are they slower than normal or not? Do your log observation counts look normal or not?
Also remember that if you are using a remote SAS server, your program might be running slower because the server is heavily loaded with other users, and there is no issue with your program. To test this out run your program outside of normal business hours. Does that speed it up a lot? Also talk to your SAS adminisitrators for advice.
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.