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 is the difference between the proc sql and data step?

0 Answers  


1.What is the difference between _NULL_ , _ALL_, and _N_? 2.What are the uses of _NULL_ using in Data Steps? Can we _NULL_ in Proc Steps also? 3.How do call the macro variable in Data Steps? 4.How to construct Pivot tables in Excel Using SAS?

3 Answers  


What are the scrubbing procedures in sas?

0 Answers  


Describe the ways in which you can create macro variables? : sas-macro

0 Answers  


Can you use a macro within another macro? If so how would SAS know where the current acro ended and the new one began?

2 Answers  


hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?

0 Answers   Pfizer,


How do you add a number to a macro variable?

2 Answers  


explain the difference between alternate key, business key, foreign key, generated key, primary key, retained key and surrogate key ? : Sas-di

0 Answers  


Can you execute a macro within a macro? Describe. : sas-macro

0 Answers  


/* To determine the maximum and minimum of V1 */ data before3; input v1 v2 v3; cards; 3 2 1 4 6 5 2 1 3 6 5 4 1 3 2 5 4 6 ; run;

5 Answers  


How do you debug and test your SAS programs?

0 Answers   Quintiles,


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

0 Answers  


Categories