DATA Step, Macro, Functions and more

SAS

Reply
Occasional Contributor
Posts: 11

SAS

data new;

set sashelp.class;

run;

 

How to take last two letters from string for name variable?

PROC Star
Posts: 552

Re: SAS

like this

 

data _NULL_;
   string = 'SomeString';

   last_two = substr(trim(string),length(trim(string))-1);

   put last_two;
run;
Occasional Contributor
Posts: 11

Re: SAS

@draycutThank You

Ask a Question
Discussion stats
  • 2 replies
  • 118 views
  • 0 likes
  • 2 in conversation