the goal of the below program is to count the numeric values pass the decimal point.
if the selected variable has numbers after the decimal the name is recorded. overall i want a file with the applicable variables names.
the problem is that i am trying to resolve is to perform this operator for 11k variables. i have tried to load the vars in a macro but they exceed the max length. i have also tried some proc sql steps but admit that i dont use sql. any suggestions?
%let var=weight;
data mac;
set desk.opa(keep=&var) end=eof;
length name $ 25;
hasFlag = (length(trim(left(scan(&var , 2 , '.' ))))) > 2 ;
if hasFlag >0 then count+ 1;
if count gt 0 then NAME="&var";
if eof then output;
run;
this works as desired but for only this var.
tried
proc sql noprint ;
create table vars as
select name
from dictionary.columns
where memname = 'OPA'
order by name ;
select distinct name
into :origvars separated by ' '
from vars
order by name ;
quit ;
%let var=&origvars;
data mac;
set desk.opa(keep=&var) end=eof;
length name $ 25;
hasFlag = (length(trim(left(scan(&var , 2 , '.' ))))) > 2 ;
if hasFlag >0 then count+ 1;
if count gt 0 then NAME="&var";
if eof then output;
run;
this is where i get "exceeds max length error" and the "expecting a arithmetic operator", separating the string of variables. this was not resolved but changing the into :origvars separated by ' ' to into :origvars separated by ','
... View more