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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: