Hi all,
My problem is to break up a large data-set into smaller ones as below.
I have a data set containing about ~1000 variables. I converted each of these variable names to macro-variables called: varname1,varname2,,,varname100,...etc.
Now I need to generate smaller data-sets , each containing only 5 variables. For example, I tried the following SAS macro code but I get an error.
%macro batch_Chk(start,fin);
%do i =&start %to &fin by 5;
%let res=%evalf(&i. + 4);
%do j =&i. %to &res. by 1;
data words_&i.; /* Words_i are the sub-data-sets with 5 variables each */
set transf_vars; /* Transf_vars is the Original data */
%put &res; /* check res value...*/
keep &&varname&i.- &&varname&res.;
%end;
run;
%end;
%mend;
%batch_Chk (1,10);
SYMBOLGEN: Macro variable START resolves to 1 SYMBOLGEN: Macro variable FIN resolves to 10 ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &fin by 5 ERROR: The %TO value of the %DO I loop is invalid. ERROR: The macro BATCH_CHK will stop executing.
My goal is to have the 1000 variables (along with their content) broken into smaller data-sets with just 5 variables each.
I initially thought I could change the variable names to macro-variables and manipulate them inside a DO loop - but I am not getting the results I hoped for. Would really appreciate any advise or help about this problem!
Thanks very much!
... View more