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


Please Help Members By Posting Answers For Below Questions

what is the basic structure sas administrator? : Sas-administrator

561


what is metadata? : Sas-bi

596


What is the difference between %put and symbolgen? : sas-macro

667


Hi Jeevan/Akshara I have tried to contact SASI Vats for latest Advanced SAS Programming Certification Dumps (A00-212) but have not got any response. I would highly and gratefully appreciate your assistance in this regard. If you guys have access to this, would you be kind enough to forward it to me ? I would abide by all the terms you have for this. Please, note my email id: upretigopi@yahoo.com Preti Sharma

3056


What is program data vector (pdv)?

629






what is business intelligence? : Sas-bi

577


How we can create SAS USER DEFINED CODE?

1609


What are the default statistics that proc means produce?

598


how to change the execute of macro

1669


What are the features of SAS?

575


What is the different between functions and PROCs that calculate the same simple descriptive statistics?

1222


What is the use of %include statement?

617


if you were told to create many records from one record, show how you would do this using array and with proc transpose? : Sas programming

538


what is sas metadata repository? : Sas-bi

595


Explain how merging helps to combine data sets.

607