How do I use the Compress function without crashing my session

Accepted Solution Solved
Reply
Regular Learner
Posts: 1
Accepted Solution

How do I use the Compress function without crashing my session

Hi all,

 

I am trying to compress unwanted characters from a variable to remain with digits only. The dataset has about 1.8 million records and everytime I run the code EG crashes. I have tried restricting the OBS to say 1000 and that works fine. How can I avoid EG crashing when I run the code on the whole dataset. Code example below:

 

data test_003

(keep =

 

variable_1

variable_2

variable_3

variable_4);

set work.test_oo1;

variable_4_new=compress(variable_4,'','kd');

run;

 

So I am trying to compress variable_4 and have digits only remaining without out crashing my session.

 

 


Accepted Solutions
Solution
Thursday
Super Contributor
Posts: 506

Re: How do I use the Compress function without crashing my session

It sounds like some sort of memory leak or disk space issue although 1.8M obs isn't that huge.

 

Try increasing the amount of available memory with the Memsize option http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n0srij4mcdpzv2n1vt... although note that this has to be done at invocation of the session or in the config file.

View solution in original post


All Replies
Solution
Thursday
Super Contributor
Posts: 506

Re: How do I use the Compress function without crashing my session

It sounds like some sort of memory leak or disk space issue although 1.8M obs isn't that huge.

 

Try increasing the amount of available memory with the Memsize option http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n0srij4mcdpzv2n1vt... although note that this has to be done at invocation of the session or in the config file.

Super Contributor
Posts: 411

Re: How do I use the Compress function without crashing my session

How many variables are in work.test_oo1? Moving the keep-Option to the set-statement could help. 

Super User
Posts: 5,972

Re: How do I use the Compress function without crashing my session

[ Edited ]
Posted in reply to andreas_lds

Absolutely right, move keep= to the SET statement.  The way the program is written now, why bother to create the new variable?  It wouldn't even become part of the new data set?

 

If this program really crashes EG, you might just need to clean out the WORK area (or more simply, just close down EG and start up a new session).  From the names of your data sets, it's possible you have run so many tests that you are filling up the WORK area with data sets that you no longer need.

Super User
Posts: 10,313

Re: How do I use the Compress function without crashing my session

variable_4_new=compress(variable_4, ,'kd');
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 86 views
  • 1 like
  • 5 in conversation