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';

Answers were Sorted based on User's Feedback



what is the difference between x=substr(name,1,2); and substr(name,1,2)='x';..

Answer / 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

what is the difference between x=substr(name,1,2); and substr(name,1,2)='x';..

Answer / pratik

I agree with the first answer just a change is .it will be
"x ttwik" rather than "xttwik" as the replacement happens from the first loacation not as a whole.

Is This Answer Correct ?    14 Yes 0 No

what is the difference between x=substr(name,1,2); and substr(name,1,2)='x';..

Answer / oanhntt

x=substr(name,1,2) means you assign x value equal to the
first 2 characters of variable "name" while
substr(name,1,2)='x' just compare these fist 2 characters to
value 'x', so this seem useless without condition syntax
(correct one should be: if substr(name,1,2)='x' then /*do
some thing*/;).

Is This Answer Correct ?    4 Yes 16 No

Post New Answer

More SAS Interview Questions

what are the categories that sas informats are used to the place the data? : Sas-administrator

0 Answers  


What SAS statements would you code to read an external raw data file to a DATA step?

10 Answers   NIIT,


What Proc glm does?

0 Answers  


How does Mr.Lanka Srinivas teach SAS? Are his accomplishments real? What are the future prospects for SAS?

1 Answers   Student,


List down the reasons for choosing sas over other data analytics tools.

0 Answers  


In the SAS Data step what is the difference between the subsetting done by Where and subsetting done by If?

6 Answers   Cognizant,


What function CATX syntax does?

0 Answers  


Code the MEANS to produce output to be used later.

2 Answers  


What is PROC in SAS?

0 Answers  


Where do the database management systems store data and how do u import them.

2 Answers   L&T,


what are the three main credit bureau names

1 Answers   Synchrony Financial,


what is the difference between x=substr(name,1,2); and substr(name,1,2)='x';

3 Answers   HSBC,


Categories