data nums; infile datalines dsd delimiter='ab'; input X Y Z; datalines; 1aa2ab3 4b5bab6 7a8b9 ;
run;
Output:
The SAS System OBS X Y Z 1 1 . 2 2 4 5 . 3 7 8 9
In the DELIMITER= statement you specify list of individual delimiters, in this example you have two individual delimiters a and b.
The question now is, What if we have two or more consecutive delimiters? You have two cases for that:
1- DELIMITER= alone
Any combination of consecutive delimiter are treated as only one delimiter. So if you deleted the statment DSD in the infile statment from your example.
In the dataset example: 1aa2ab3
will be treated as: 1 aa 2 ab 3
as if
1,2,3
2- DELIMITER= with DSD
Consecutive delimiters are treated individually even if they are consecutive.
In the dataset example: 1aa2ab3
will be treated as: 1 a Missing a 2 a Missing b 3
as if
1, , 2, , 3
This example is explained here:
I have read that. I did not understand it.
In the DELIMITER= statement you specify list of individual delimiters, in this example you have two individual delimiters a and b.
The question now is, What if we have two or more consecutive delimiters? You have two cases for that:
1- DELIMITER= alone
Any combination of consecutive delimiter are treated as only one delimiter. So if you deleted the statment DSD in the infile statment from your example.
In the dataset example: 1aa2ab3
will be treated as: 1 aa 2 ab 3
as if
1,2,3
2- DELIMITER= with DSD
Consecutive delimiters are treated individually even if they are consecutive.
In the dataset example: 1aa2ab3
will be treated as: 1 a Missing a 2 a Missing b 3
as if
1, , 2, , 3
Thanks a lot!!
What part don't you understand?
Things you should understand:
1. What are the delimiters?
2. What does the DSD option do?
Try the code with the above removed and variations on the DLM to help figure out what's going on.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.