BookmarkSubscribeRSS Feed
thanikondharish
Fluorite | Level 6
%let a=abcd,efgh@hijk ;

%let b=%index(&a,c) ;

I want to know postion of c letter but the above not working
4 REPLIES 4
Reeza
Super User

Your example will not work because what the macro processor see's the following which is too many parameters since you have two comma's in there now.

 

%let a=abcd,efgh@hijk ;

%let b=%index(abcd,efgh@hijk,c) ;


@thanikondharish wrote:
%let a=abcd,efgh@hijk ;

%let b=%index(&a,c) ;

I want to know postion of c letter but the above not working

 

thanikondharish
Fluorite | Level 6
I understood what your told but how to know the c letter position
Thanks,
Harish
Pmyosh
Obsidian | Level 7

Hi 

You can put inside the %BQUOTE function

 

%let a=%BQUOTE(abcd,efgh@hijk) ;

%let b=%index(&a,c) ;

%PUT &b. &a.;



OUTPUT:
76    %let a=%BQUOTE(abcd,efgh@hijk) ;
77    
78    %let b=%index(&a,c) ;
79    
80    %PUT &b. &a.;
3 abcd,efgh@hijk
thanikondharish
Fluorite | Level 6
Thanks, it's working

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 4 replies
  • 1082 views
  • 1 like
  • 3 in conversation