IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SAS Requirement - remove the trailing ‘{‘ from a variabl


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
venktv

New User


Joined: 29 Mar 2006
Posts: 59
Location: Montreal

PostPosted: Mon Sep 08, 2008 1:57 pm
Reply with quote

Hi Friends,

The requirement is to remove the trailing ‘{‘ from a variable using SAS code.

For eg.:

If Var1 is ‘ABC}}}}}}}}}’ then only ‘ABC’ should be retained
If Var1 is ‘ABC}}}}}}}XYX’ then ‘ABC}}}}}}}XYX’ should be the output
If Var1 is ‘ABC}}}}}}}XYX}}}}}}}}}’ then ‘ABC}}}}}}}XYX’ should be the output
If Var1 is ‘}}}}}}}}}}’ then the output should be null


Can you pls help me to write a logic in SAS language

Thanks
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 08, 2008 5:08 pm
Reply with quote

The easiest way i can think of is
Code:
var1rev = reverse(var1) ;
do while (substr(var1rev,1,1) = '}');
   var1rev = substr(var1rev, 2) ;
end;
var1 = reverse(var1rev);
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Remove leading zeroes SYNCSORT 4
No new posts How to remove block of duplicates DFSORT/ICETOOL 8
No new posts To Remove spaces (which is in hex for... JCL & VSAM 10
No new posts How to remove spaces in between. SYNCSORT 12
Search our Forums:

Back to Top