data output;
set YourDataset; /* Replace "YourDataset" with the name of your actual dataset */
Fname = scan(full_name, 1); /* Assuming the full name is stored in a variable called "full_name" */
Lname = scan(full_name, -1); /* Extracts the last word in the full name */
/* Output the formatted names */
put "Fname: " Fname;
put "Lname: " Lname;
run;
In this code, you need to replace "YourDataset" with the actual name of your dataset containing the full names. The SCAN function is used to extract the first name ( Fname ) and last name ( Lname ) from the variable full_name . The -1 as the second argument of SCAN tells SAS to extract the last word in the string. Finally, the put statements are used to display the formatted output in the SAS log.
Make sure to adjust the code according to your specific dataset and variable names.
... View more