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 |
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
what is slowly changing dimension? : Sas-di
What is the maximum length of the macro variable?
How would you code the criteria to restrict the output to be produced?
what is the diff. b/w proc means and proc summary?
What is program data vector (pdv) and what are its functions?
i want for interview question & answer plz it need immediate send t my mail raviprakashmot@gmal.cm
what are sas bi dashboard components? : Sas-bi
How long can a macro variable be? A token? : sas-macro
How do you add a number to a macro variable?
What is the difference between verification and validation?
Can you execute macro within another macro? If so, how would sas know where the current macro ended and the new one began? : sas-macro