Select all variables with common suffix

Reply
Contributor
Posts: 62

Select all variables with common suffix

[ Edited ]

want to select all the varibale which ends with K?

 

 

 

proc sql;
select name into:a from dictionary.columns where libname="WORK"
and memname="TEST1" and upcase(substring(name,length(name)-1,length(name)))='%k';

Super User
Posts: 9,865

Re: sas

proc sql;

select name into : a separated by ' '

 from dictionary.columns

  where libname="WORK" and memname="TEST1" and upcase(strip(name)) like '%K';

 

 

??

Super User
Super User
Posts: 7,694

Re: sas

Hi,

 

Use revese:

proc sql;
  select NAME 
  into    :A 
  from   DICTIONARY.COLUMNS
  where LIBNAME="WORK"
     and MEMNAME="TEST1" 
     and substr(strip(reverse),1,1)="K";
quit;
Ask a Question
Discussion stats
  • 2 replies
  • 288 views
  • 1 like
  • 3 in conversation