- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Greeting of the day!
I have below column as demo_table which has a row like this, so when I'm using scan function to split them into separate columns then third column is not scanning properly.
cas-shared-default datascientst _[ 0680 ] تقرير عدد البلاغات بناء على الشخص unloaded
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data have;
Table_Names="cas-shared-default datascientst _[ 0680 ] تقرير عدد البلاغات بناء على الشخص unloaded";
Server_Name=scan(Table_Names, 1, ' ');
CASLIB_Name=scan(Table_Names, 2, ' ');
call scan(Table_Names,3,p1,l1,' ');
call scan(Table_Names,-1,p2,l2,' ');
Table_Name=substr(Table_Names,p1,p2-p1);
Table_State=scan(Table_Names,-1, ' ');
drop p1 p2 l1 l2;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What is wrong with the result? It seems perfectly correct to me, based upon the code you wrote. What result are you expecting?
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Expected result
_[ 0680 ] تقرير عدد البلاغات بناء على الشخص
Current result
_[
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@SurajChand wrote:
I want Table_Name column should have full table name instead of some portion
Expected result
_[ 0680 ] تقرير عدد البلاغات بناء على الشخص
Current result
_[
Please describe the logic that a programmer could use to determine that some spaces are to be used as separators between words but other spaces are not used that way. I am not asking for code, I am asking for words to explain this.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think I figured out a solution
data have;
string='cas-shared-default datascientst _[ 0680 ] تقرير عدد البلاغات بناء على الشخص unloaded';
word1=scan(string,1,' ');
word2=scan(string,2,' ');
temp_word3=scan(string,3,' ');
where3=find(string,temp_word3,'t');
word4=scan(string,-1,' ');
where4=find(string,word4,'t');
word3=substr(string,where3,where4-where3-length(temp_word3)-1);
run;
In order for the above to be a correct answer, I have made a number of assumptions and decided upon a logic which may not be correct for other text strings that you have.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
There is no SCAN statement in SAS. There is the SCAN function and the CALL SCAN subroutine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data have;
Table_Names="cas-shared-default datascientst _[ 0680 ] تقرير عدد البلاغات بناء على الشخص unloaded";
Server_Name=scan(Table_Names, 1, ' ');
CASLIB_Name=scan(Table_Names, 2, ' ');
call scan(Table_Names,3,p1,l1,' ');
call scan(Table_Names,-1,p2,l2,' ');
Table_Name=substr(Table_Names,p1,p2-p1);
Table_State=scan(Table_Names,-1, ' ');
drop p1 p2 l1 l2;
run;