BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
novinosrin
Tourmaline | Level 20

First off, my apologies for the lame question perhaps lack of sleep, tiredness or whatever.

Ok question, from sas function documentation

 

charlist

specifies an optional character expression that initializes a list of characters. This list determines which characters are used as the delimiters that separate words. The following rules apply:

  • By default, all characters in charlist are used as delimiters.

  • If you specify the K modifier in the modifier argument, then all characters that are not in charlist are used as delimiters.

Tip: You can add more characters to charlist by using other modifiers.

 

 

where is the charlist list in sas documentation? This irks me

1 ACCEPTED SOLUTION
4 REPLIES 4
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

I have found a few in SAS help but never found a full list.

novinosrin
Tourmaline | Level 20

Thank you @PaigeMiller  That's the doc i needed. Hmm the answer i wanted was right there viz.

 

Using Default Delimiters in ASCII and EBCDIC Environments

If you use the SCAN function with only two arguments, then the default delimiters depend on whether your computer uses ASCII or EBCDIC characters.
  • If your computer uses ASCII characters, the default delimiters are as follows:
    blank ! $ % & ( ) * + , - . / ; < ^ |
    In ASCII environments that do not contain the ^ character, the SCAN function uses the ~ character instead.
  • If your computer uses EBCDIC characters, then the default delimiters are as follows:
    blank ! $ % & ( ) * + , - . / ; < ¬ | ¢
 
If you use the modifier argument without specifying any characters as delimiters, then the only delimiters that are used are delimiters that are defined by the modifier argument. In this case, the lists of default delimiters for ASCII and EBCDIC environments are not used. In other words, modifiers add to the list of delimiters that are explicitly specified by the charlist argument. Modifiers do not add to the list of default modifiers.
novinosrin
Tourmaline | Level 20

And why the problem arose was thanks to this :

 when i desired (1995)

1013 data _null_;
1014 k='Toy Story (1995)';
1015 k1=scan(k,-1);
1016 put k1=;
1017 run;

k1=1995

 

 

 

and it's pretty apparent, the explicit charlist specification was needed

 

data _null_;
k='Toy Story (1995)';
k1=scan(k,-1,' ');
put k1=;
run;

 

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 1326 views
  • 0 likes
  • 3 in conversation