I want to define length for some particular columns in select statement and i want to concatenate the two columns i.e sponsor id
and sponsor
like "ABC-123" in SAS proc sql . Please help
here is the code
proc sql;
select
project_id,
sponsor_id,
empl_country,
region,
empl_dept_descr,
empl_bu_descr,
sponsor,
full_name,
mnth_name FROM Stage0;
quit;
If you don't know the length you can use a strip() function which will remove leading and trailing spaces, in this case it will remove the spaces generated by the catx() default length:
strip(catx('-', sponsor_id, sponsor))
Code:
proc sql;
select
project_id,
sponsor_id,
empl_country,
region,
empl_dept_descr,
empl_bu_descr,
sponsor,
full_name,
mnth_name ,
/* New column */
strip(catx('-', sponsor_id, sponsor)) as new_id
FROM Stage0;
quit;