Hi Team i want a new column output from below mentioned text dynamically.Kindly help on this.
Sample Data:
DATA TEST;
NEW='SBIP://METASERVER/BI SAS VA REPORTS/AR Testing [Should always be in sync with Production]/Quality Dashboard V1(Report)';
TEST1 =(TRANSLATE(scan(NEW, -1,'/'),' ','_'));
FORMAT NEW $150. TEST1 $75.;
RUN;
Out put want:
column1_want ="Quality Dashboard";
colunm2_want = "SBIP://METASERVER/BI SAS VA REPORTS/AR Testing [Should always be in sync with Production]"
DATA TEST;
NEW='SBIP://METASERVER/BI SAS VA REPORTS/AR Testing [Should always be in sync with Production]/Quality Dashboard V1(Report)';
FORMAT NEW $150. TEST1 $75.;
RUN;
data want;
set test;
temp=scan(new,-1,'/');
column1_want=substr(temp,1,findc(temp,'(','b')-1);
colunm2_want=substr(new,1,findc(new,'/','b')-1);
drop temp;
run;
Hi @sivastat08 Why is V1(Report) missing in your output column1_want ?
yes sir , i want (Report) should be removed from the text
i want output like this
column1_want ="Quality Dashboard V1"
Thanks!
DATA TEST;
NEW='SBIP://METASERVER/BI SAS VA REPORTS/AR Testing [Should always be in sync with Production]/Quality Dashboard V1(Report)';
FORMAT NEW $150. TEST1 $75.;
RUN;
data want;
set test;
temp=scan(new,-1,'/');
column1_want=substr(temp,1,findc(temp,'(','b')-1);
colunm2_want=substr(new,1,findc(new,'/','b')-1);
drop temp;
run;
@sivastat08 wrote:
Thank a lotSir
Haven't earned that. Btw, these kind of solutions that uses scan/find/call scan have been demonstrated extensively by Guru @data_null__ in many of his posts in SAS L .
SAS-L however doesn't let users who do not have an account. What a spoil sport!!! . I don't have an account either.
A little trickery with SAS character functions:
data have;
new = 'SBIP://METASERVER/BI SAS VA REPORTS/AR Testing [Should always be in sync with Production]/Quality Dashboard V1(Report)';
run;
data want;
set have;
index = findc(new,'/',length(new)*(-1));
column1_want = scan(substr(new,index+1),1,'(');
column2_want = substr(new,1,index-1);
drop index;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.