Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 sas metadata server? : Sas-di

1051


Which date function advances a date, time or datetime value by a given interval?

1082


Are you sensitive to code walk-throughs peer review or QC review?

3093


How to import multiple xls files into sas. Out of those files, how to get different values from a single variable and how to find number of rows per value type? We can do this using group by for one xls file with proc sql. Was wondering how I can achieve this for multiple files at the same time. Any ideas?

2858


What can you learn from the SAS log when debugging?

1317


what is function of retain statment

1978


How to create an external dataset with sas code?

1073


what is sas application server? : Sas-di

1000


How do dates work in sas?

1074


What is the command used to find missing values?

1040


Which are the statements whose placement in the data step is critical?

1190


how would you create a data set with 1 observation and 30 variables from a data set with 30 observations and 1 variable? : Sas programming

1279


What are the features of SAS?

973


what is the purpose of _error_? : Sas programming

1084


what is sas and what are the functions? : Sas-administrator

933