what is the difference between x=substr(name,1,2);
and substr(name,1,2)='x';
Answer Posted / sattwik panda
x=substr(name,1,2) will return first two character of a string whereas substr(name,1,2)='x' will replace first two character by 'x'.
Please try using the code below to get an idea.
data test;
name="Sattwik";
x=substr(name,1,2);
substr(name,1,2)='x';
run;
x will have the first two characters of name:'Sa'.
substr(name,1,2)='x' will replace first two characters of "Sattwik". So, now the name will contain "xttwik".
Is This Answer Correct ? | 46 Yes | 2 No |
Post New Answer View All Answers
Can you execute macro within another macro? : sas-macro
What is the difference between SAS functions and procedures?
what is star schema? : Sas-di
what does the run statement do? : Sas programming
what is the purpose of _error_? : Sas programming
What do the PUT and INPUT functions do?
What are the default statistics that proc means produce?
name some data transformation used in sas di? : Sas-di
describe the interaction table in sas di? : Sas-di
Given an unsorted data set, how to read the last observation to a new data set?
what is transformation in sas data integration? : Sas-di
What is a pdv and what are its functions?
: and & modifiers.
do you prefer proc report or proc tabulate? Why? : Sas programming
This entry was posted in General. Bookmark the permalink. Post a comment or leave