data test (keep=ln_no BO_BORR_FST_NM
BO_BORR_LAST_NM BO_BORR_MDL_NM BO_BORR_NM YE_BORR_ID_NO);
set data1;
if ye_borr_id_no in ('9897'
'4231'
'6240'
'3708'
'9517');run;
Is there an alternative process to include all of the numbers in quotes without having to physically place quotes between all values. For example '9897'. I have about 900 of these to place after the ye_borr_id_no. I know I can do a table using cards like this
data test;
input id_no $4.;
cards:
9897
etc........;
run;
I just need to perhaps incorporate this into the datastep.
Use quote function
Create the table test and use a SQL query instead:
proc sql;
create table want as
select *
from data1 where ye_borr_id_no in (select id_no from test);
quit;
For 900 you are better off using a data set and using SQL or MERGE to do the sub setting.
But if you want to generated quoted list from space delimited list than TRANWRD can help.
%let list=9897 4231 6240 ;
%let qlist="%sysfunc(tranwrd(&list,%str( )," "))";
%put &qlist;
And yet another way:
proc format library=work;
value $mylist
9897,
4231,
6240,
3708 = 'Valid'
;
run;
data _null_;
do x= '9897','5555';
if put(x,$mylist.)='Valid' then put 'In list';
else put 'not in list';
end;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.