As suggested in the header, I would like to remove all empty columns / variables (where all entries are empty or equal to zero or "") to reduce time spent on subsequent execution.
Detailed scenario:
I have a dataset () with 1000 columns, some \ lots of which are empty. Now I want to create a new data set in which I need to add columns under certain conditions of the previous data set.
data new; set old; if oldcol1 ne "" then newcol1='<a>'||strip(oldcol1)||'</a>'; end; if oldcol2 ne "" then newcol2='<a>'||strip(oldcol2)||'</a>'; end; ... ...; drop oldcol1 oldcol2.....oldcol1000; run;
It takes enough time to complete, given the following reason:
Colnumber
1 2 3
...
1000
So, you can imagine how many times you need to perform in terms of searching, searching and setting values.
Therefore, one of the ways in which time could be reduced is to first clear all empty columns. But any material regarding algorithm optimization is also welcome.
thanks
source share