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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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