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
Briefly explain input and put function?
What are the special input delimiters used in SAS?
Explain why double trailing @@ is used in input statement?
why is sas considered self-documenting? : Sas programming
WHAT IS SAS WEB SERVICE and what are the steps to create an xml service ?
How do you connect the desktop application to metadata server? : sas-grid-administration
What are SAS/ACCESS and SAS/CONNECT?
What is SAS?
Is the physical structure of the data set in the same orientation as the report? Do you need to reshape the data sets? What method should you use to reshape the data–DATA steps,PROC TRANSPOSE,output data set from a procedure?
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
How do you delete duplicate observations in sas?
how to remove duplicates using proc sql?
I have a dataset concat having variable a b & c. How to rename a b to e & f?
Mention how to limit decimal places for the variable using proc means?
what are the categories that sas informats are used to the place the data? : Sas-administrator