BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jeevan007
Calcite | Level 5
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
1 ACCEPTED SOLUTION

Accepted Solutions
mohamed_zaki
Barite | Level 11

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: aa 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

View solution in original post

5 REPLIES 5
Jeevan007
Calcite | Level 5

I have read that. I did not understand it.

mohamed_zaki
Barite | Level 11

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: aa 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

Reeza
Super User

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. 

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1308 views
  • 0 likes
  • 3 in conversation