Christmas is just at the end of this week, so we at team DexLab decided to help our dear readers who love some data-wizardry, with some SAS magic! You can choose to flaunt your extra SAS knowledge to your peer groups with the below described SAS program.
We are taking things a tad backwards by trying to, almost idiosyncratically complicate things that are otherwise simple. After all some say, a job of a data analyst is to do so! However, be it stupid or unnecessary this is definitely by far the coolest way to wish Merry Christmas, in data-analyst style.
The main idea behind this SAS program is to show case your creativity and solve otherwise easy problems with some extra complexity and to learn a few cool new tricks that can be later used to solve real complex problems that may arise in the future.
Confused as to what we mean? Try your hands on the following program and find out what we mean…
If you still do not know how to run SAS programs then take a SAS predictive modeling training with us at DexLab Analytics.
DATA A(KEEP=WISH); LENGTH WISH $15 F1 $5 F2 $9; DO J= 1 TO 5; IF J = 1 THEN K = TAN(4.702389315) / ATAN(3.584020431); ELSE IF J = 2 THEN K = SUM(INPUT(PUT('99',$HEX2.),8.), INPUT(PUT('0',$HEX2.),8.)); ELSE IF J <= 4 THEN K = SUBSTR(PUT('12JAN2004'D , 5.),4, 2); ELSE IF J = 5 THEN K = ROUND(CONSTANT("PI")*30, 10) - 1; SUBSTR(F1,J)=BYTE(K); END;
DO I= 1 TO 9; IF I = 1 THEN K = 100 / ARCOS(0.078190328); ELSE IF I = 2 THEN K = MOD(CONSTANT("PI") / 3, 2*CONSTANT("PI")) * 360/(2*CONSTANT("PI")) + 3*4; ELSE IF I = 3 THEN K = SUBSTR(PUT('12JAN2004'D , 5.),4, 2); ELSE IF I = 4 THEN K = ROUND(2**6.189823562,1); ELSE IF I = 5 THEN K = EXP(4.418841708); ELSE IF I = 6 THEN K = MEDIAN(82,86); ELSE IF I = 7 THEN K = TAN(4.702389315) / ATAN(3.584020431); ELSE IF I = 8 THEN K = SUM(INPUT(PUT('69',$HEX2.),8.)-1, INPUT(PUT('0',$HEX2.),8.)); ELSE IF I = 9 THEN K = EXP(4.418841708); END;
WISH = CATX(' ',F1,F2); OUTPUT; PROC PRINT NOOBS; RUN;
The output of the above given program has not been put here. Because keeping up with Christmas spirit, we have kept that from the readers for reasons of surprise and mystery.
So, try this program out in SAS and tell us the output in the comment section below!
With the BYTE() function you can create character values. This function helps to return the character value against the ASCII code. Try running the BYTE() function and see what happens, and what it evaluate.
Try and run the program mentioned below and see the log:
data _null_; x = byte(65); put x=; run;
The result: A, the above program will return A.
Just like that you can create A to Z alphabets with the following program:
data _null_; do i = 65 to 90; x = byte(i); put x; end; run;
Note: we recommend that you see the log after submitting the above mentioned code.
Here are the steps:
Step 1 : TAN(4.702389315) returns 100
Step 2 : ATAN(3.584020431) returns 1.2987
Step 3 : = 100 / 1.2987 is equal to 77
Step 4: BYTE(77) returns M of ‘MERRY’
Wondering how to know the exact value of the angle before making use of the TRIGNO function?
Use the Goal Seek Feature of MS Excel for the same. We offer advanced excel training in Delhi for those keen on learning such functions.
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.