Hi Peter_c,
Thanks for your code. Itried but it is not working. The log shows:
120 data readin ;
121
122 set inf1.'Insurance Serv-Quest$a1:iv64000'n;
123 run;
NOTE: There were 277 observations read from the data set INF1.'Insurance
Serv-Quest$a1:iv64000'n.
NOTE: The data set WORK.READIN has 277 observations and 10 variables.
NOTE: Compressing data set WORK.READIN decreased size by 96.77 percent.
Compressed is 3 pages; un-compressed would require 93 pages.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
124
125 proc contents data=readin ; run;
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
126
127
128
129 libname _all_ clear ;
NOTE: Libref FIN has been deassigned.
NOTE: Libref INF1 has been deassigned.
129! run;
130 options compress=yes mprint mlogic symbolgen;
131
132 libname fin 'c:\' ;
NOTE: Libref FIN was successfully assigned as follows:
Engine: V9
Physical Name: c:\
133
134 libname inf1 odbc noprompt=XXXXX
135 C:\temp\Experian Subcodes.xls;
136 Deleted=1;Driver={Microsoft excel Driver (*.xls)};ReadOnly=0";
NOTE: Libref INF1 was successfully assigned as follows:
Engine: ODBC
Physical Name:
137
138 data readin ;
139
140 set inf1.'Insurance Serv-Quest$a1:iv64000'n;
141 run;
NOTE: There were 277 observations read from the data set INF1.'Insurance
Serv-Quest$a1:iv64000'n.
NOTE: The data set WORK.READIN has 277 observations and 10 variables.
NOTE: Compressing data set WORK.READIN decreased size by 96.77 percent.
Compressed is 3 pages; un-compressed would require 93 pages.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
142
143 proc contents data=readin ; run;
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
144
145 data reduced_rows( drop= empty) ;
146 retain empty ' ' ;
147 array nums(*) _numeric_ _n_ ; * have at least one numeric ;
148 array chrs(*) _character_ empty ;**** mark non-empty columns ;
149 array numsc(1000) _temporary_; * assume have no more than 1000 num var ;
150 array chrsc(1000) _temporary_; * assume have no more than 1000 chr var ;
151
152 set readin end= eof;
153
154 do _n_ = 1 to dim(nums) ;
155 numsc(_n_) + ^missing( nums(_n_)) ;
156 end;
157
158 do _n_ = 1 to dim(chrs) ;
159 chrsc(_n_) + ^missing( chrs(_n_)) ;
160 end;
161
162 **** after looking through all data, prepare a drop list for empty columns ;
163 if eof then do;
164 %let drop_list= ; *ensure prepared and empty by default;
165 call execute( '%nrstr( %%let drop_list= )' ) ;
166
167 do _n_ = 1 to dim(chrs)-1 ;
168 if ^chrsc(_n_) then call execute( vName( chrs(_N_) ) ) ;
169 end;
170
171 do _n_ = 1 to dim(nums)-1 ;
172 if ^numsc(_n_) then call execute( vName( nums(_N_) ) ) ;
173 end;
174 call execute( ' ; ' ) ;
175
176 end;
177 ***** removing empty rows ;
178
179 if n( of nums(*) ) le 1 then do; * no numerics so check chrs ;
180 if catt( of chrs(*) ) = ' ' then delete ;
181 end;
182 run;
NOTE: There were 277 observations read from the data set WORK.READIN.
NOTE: The data set WORK.REDUCED_ROWS has 0 observations and 10 variables.
NOTE: DATA statement used (Total process time):
real time 0.07 seconds
cpu time 0.03 seconds
NOTE: CALL EXECUTE generated line.
182! * finally apply that drop list ;
1 + %let drop_list=
2 + empty
3 + ;
183
184 data reduced_rows_and_cols ;
185 set reduced_rows(
SYMBOLGEN: Macro variable DROP_LIST resolves to empty
185! drop= &drop_list );
ERROR: The variable empty in the DROP, KEEP, or RENAME list has never been referenced.
186 run;
NOTE: Compression was disabled for data set WORK.REDUCED_ROWS_AND_COLS because compression
overhead would increase the size of the data set.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.REDUCED_ROWS_AND_COLS may be incomplete. When this step was stopped
there were 0 observations and 0 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
187
188
189
190
191 libname _all_ clear ;
NOTE: Libref FIN has been deassigned.
NOTE: Libref INF1 has been deassigned.
191! run;
Thanks