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 |
hi i date is 05sep2005; i want the oupput like 05sep2005:00:00:00 ; how it wil come?
For what purpose would you use the RETAIN statement?
tell me about intnx, intcx functions?
data data1; input dt account; format dt date9.; cards; 1745 1230 1756 1120 1788 1130 1767 1240 ; data data2; input startdt enddt total; format startdt date9. enddt date9.; cards; 1657 1834 12300 1557 1758 16800 1789 1789 12300 1788 1345 12383 1899 1899 13250 ; proc sql; create table data3 as select * from data1 as x left join data2 as y on x.dt>=y.startdt and x.dt<=y.enddt; quit; Here, we are getting cartision product. But,I want left join report consisting of this program. It should not get duplicate values. you can modify the program also.
how do u validate sas program
how to get second highest salary from a employee table and how get a 5th highest salary from a employee table?
Where do you use proc means over proc freq?
what is Business Intelligence?
How to sort in descending order?
how to extract data from SAP servers? Is like oracle servers or any other methods to extract please reply me.
For clinical entire study how many tables will create approx?
what does the run statement do? : Sas programming