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 |
In ARRAY processing, what does the DIM function do?
if the Id has more then two transcatiion then show the first observation, IF Id has only two observation then It show both the observation
explain the function of substr in sas? : Sas-administrator
how do you want missing values handled? : Sas programming
Code a PROC MEANS that shows both summed and averaged output of the data.
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?
how can u extract,transform and loading?
Explain the message 'Merge has one or more datasets with repeats of by variables'.
what is program data vector? : Sas-administrator
What is the difference between verification and validation?
What are the statements in proc sql?
do you need to know if there are any missing values? : Sas programming