what is the difference between x=substr(name,1,2);
and substr(name,1,2)='x';

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between format and informat? : sas-grid-administration

818


which date functions advances a date time or date/time value by a given interval? : Sas programming

761


How to limit decimal places for variable using proc means?

816


Explain data_null_?

819


how to read the variables in sas? : Sas-administrator

799


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.

2043


hi here is a problem can anybody solve this? i want to report the data through third party file. by using data _null_ or proc report or macro automation process. but i want to insert the 'titles and footnotes' in between the data and also starting of 2nd and ending of 2nd and starting of 3rd and ending of the 3rd page. tell me how and write the code?

1898


How can I remove header from output data set?

2347


Explain input and put function?

891


Difference between sum function and using “+” operator?

861


What is the function of output statement in a SAS Program?

827


sas implementing companies in pune implementing clinical projects if anyone knows plz send ans immediately

3366


What are the features of base sas system?

812


how to create the AE dataset by using SDTMIG specifications and SAP plan by using UNIX platform?

2539


Can you explain the process of calendar?

876