When looking for data contained in a character string of 150
bytes, which function is the best to locate that data: scan,
index, or indexc?
Answers were Sorted based on User's Feedback
Answer / ganesh
Scan function the best for locating the particular word
specified in a argument,scan function default length is
200bytes.
data k;
r='ganesh kumar';
u=scan(r,2);
proc print;
run;
result: kumar
Is This Answer Correct ? | 10 Yes | 7 No |
Answer / prr
Hi Friends,
actually I can't able to understand the question.
please repeat again in a understandable way.
scan: it returns Nth word from character observation.
index: it return starting position of the character from
character observation.
index C: it returns starting position of any character from
character observation.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / rinky
The questions is to locate and not to extract any
particular word from a string of 150 bytes. SO, according
to me INDEX is the best.
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / jothi sankar
INDEX is best one. Is for getting location of mentioned
data.
Eg:
str1 = 'Hi i am fine here. how are u there ? .....';
str2 = index(str1,'how'); --> str2 = 20
SCAN is to get a substring upto mentioned character
INDEXC to locate only for mentioned one or more single
character
Is This Answer Correct ? | 5 Yes | 5 No |
Answer / yaga
I think Index is the best option to locate the word
beacause SCAN is SAS function to extract the particular
word positioned in nth place. for ex: 2 word from the string
Is This Answer Correct ? | 1 Yes | 1 No |
Does SAS ?Translate? (compile) or does it ?Interpret?? Explain.
What are the data types that sas contain?
how to add distinctly var variable values ex.. Data a; input var; datalines; 0 1 2 3 -1 -2 -3 ; run; adding all +ve value in one varibale n do the same for -ve too
how does sas handle missing values in an update? : Sas programming
What are the differences between proc means and proc summary?
for report generation which one you used proc report or data_null_?
3 Answers Accenture, Quintiles,
what is the difference between SET and MERGE?
How do you convert basic cube to transaction cube and transaction cube to basic cube?
Can you suggest us materials for sdtm mapping?
How do you write a test plan?
In the following DATA step, what is needed for ‘fraction’ to print to the log? data _null_; x=1/3; if x=.3333 then put ‘fraction’; run;
what is program data vector? : Sas-administrator