data abx;
infile datalines dlm=" ";
input name :$20. score1 score2 score3;
datalines;;
a 23 23 23
b 23 12 12
c 23 45 66
a 66 88 99
c 34 66 45
;
run;
proc sql;
select distinct name,quote(name)
into :k separeted by " ",
:j separeted by ","
from abx;
quit;
option mprint;
data &k;
set abx;
array d[*] &k ;//here i did small change it is taking array but it did not send s out put to assigned data set please help//
do i=1 to dim(d) ;
if d[i]=name then output d[i];
end;
run;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The warning and error tell you what you need to know.
1) You have mispelt separated.
2) there needs to be speace before _character_ and after it.
After that however, it really doesn't make sense to me why you are doing this in the first place? The logic is all wrong, _character_ will select all the variables in the dataset with character format, your select into macro step is selecting all variables in the dataset, overlap at the best of times, errors most of the time. Explain what it is your trying to do, show what you want out. For instance, you could forget all that code, and to proces the score data - which is numeric by the way, so _character_ will not work - you can simply do:
data want; set abc; array score{3}; do i=1 to 3; ...; end; run;
Looking further your using the output statment incorrectly as well, and comparing name to nothing. As above, post what you want to do and show some output so that we can guide you properly.
thanks
Sorry, I don't follow. Try showing what the output should be from your test data.
Sorry, without a clear cut example can't provide anything. What I would say is that what you are doing is called "binning" the data. There are numerous papers out there and several different methods. For example one way would be to normalise the data - i.e. instead of going across, have all the data going down, and then use something like proc rank:
Or apply the logic yourself in a datastep.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.