How to use SAS to split a string into two variables
dataset, sas
Solution
Use function SCAN() with comma as separator.
data test;
set test;
city=scan(country,2,',');
country=scan(country,1,',');
run;
Problem
I have a dataset as below: ``` country United States, Seattle United Kingdom, London ``` How can I split country into a data in SAS like: ``` country city United States Seattle United Kingdom London ```