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
What is a pdv and what are its functions?
What are the difference between the sas data step and sas procs?
How can I remove header from output data set?
do you prefer proc report or proc tabulate? Why? : Sas programming
what do the sas log messages "numeric values have been converted to character" mean? : Sas programming
how the sas basic syntax style described? : Sas-administrator
Give an example where SAS fails to convert character value to numeric value automatically?
Are you involved in writing the inferential analysis plan? Tables specifications?
What are the features of base sas system?
what is business intelligence? : Sas-bi
explain about various caches available in data integrator? : Sas-di
what is a method for assigning first.var and last.var to the by groupvariable on unsorted data? : Sas programming
explain the difference between alternate key, business key, foreign key, generated key, primary key, retained key and surrogate key ? : Sas-di
Can you explain the process of calendar?
how do you pull data from equifax?tell me the process?