Basically the number of functions present in the SAS program amount to three. They are Character Functions, Numeric Functions and Date and Time Functions. In this post we are going to take a brief look at Character functions of a basic nature.
Suppose that there is this program with the following lines of command:
Data Len_func ; input name $ ; cards; Sandeep Baljeet Neeta . ; run; data Len_func; set Len_func ; Len=length(name); Len_N=lengthn(name); Len_C=lengthc(name); run; proc print; run;
- The function called LENGTH returns the character value’s length.
- The function LENGTHN is more or less identical to the LENGTH function. The sole difference between the two lies in the fact that for a value missing character it returns the length that equals to 0 whereas LENGTH returns a value of 1.
- The function LENGTHC returns to the program the storage length of particular strings.
The ABC of Summary Statistics and T Tests in SAS – @Dexlabanalytics.
Again let us consider the following lines of code:
Data case ; input name $ ;cards; sandeep baljeet neeta ; New_U=upcase(name); New_P=propcase(name); run; proc print; run;
Data Preparation using SAS – @Dexlabanalytics.
Here the following functions are introduced:
- The function UPCASE converts all of the letters to the uppercase.
- The function PROPCASE serves to capitalize the first letter of all words and converts the remaining to lowercase.
- As might be guess from the convention conformed to while naming the function, LOWCASE transforms all letters to their lowercase counterparts.
In the following program commands:
Data AMOUNTS; input NAME $20.; cards; RAD-HIKA SHARMA RAJARAM PAND-IT SURESH AA-RT-I ; RUN; Data AMOUNTS; Set AMOUNTS; NAME1=COMPRESS(NAME,'-'); NAME2=COMPBL(NAME); RUN; PROC PRINT; RUN;
Here’s why SAS Analytics Is a Must-Have IT Skill to Possess – @Dexlabanalytics.
Here we can see the following syntax:
- Compress (Variable, ”want to remove”);
- Compbl (Variable)
- The function COMPRESS removes blanks by default. It can also remove a particular specified character value as indicated by the code. In the example cited the character value ‘-‘is compressed.
- On the other hand the COMPBL function serves to result in a single blank from multiple ones.
For expert guidance, you will be well advised to enroll yourself in a SAS course from a reputed SAS Training institute. You may consider DexLab Analytics if you are in the vicinity of Delhi or noida.
Interested in a career in Data Analyst?
To learn more about Machine Learning Using Python and Spark – click here.
To learn more about Data Analyst with Advanced excel course – click here.
To learn more about Data Analyst with SAS Course – click here.
To learn more about Data Analyst with R Course – click here.
To learn more about Big Data Course – click here.
online certification, online courses, SAS, sas certification, Sas course, SAS Courses and R, SAS training courses, Sas training institute