what is the difference between x=substr(name,1,2);
and substr(name,1,2)='x';
Answers were Sorted based on User's Feedback
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 |
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 |
What is the difference between the proc sql and data step?
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?
What are the scrubbing procedures in sas?
Describe the ways in which you can create macro variables? : sas-macro
Can you use a macro within another macro? If so how would SAS know where the current acro ended and the new one began?
hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?
How do you add a number to a macro variable?
explain the difference between alternate key, business key, foreign key, generated key, primary key, retained key and surrogate key ? : Sas-di
Can you execute a macro within a macro? Describe. : sas-macro
/* 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;
How do you debug and test your SAS programs?
List down the reasons for choosing sas over other data analytics tools.