代写 SAS STAT 3094: SAS Base Programming In-Class #03 (Worth 10 points)

STAT 3094: SAS Base Programming In-Class #03 (Worth 10 points)
Instructions & Scenario
This assignment is due in the form of a SAS program called LastNameFirstInitial_IN3.SAS (EG. SmithE_IN3.SAS). Submit the program in your CANVAS assignment location by the due date and time. Mark all problems clearly in a comment such as /*Problem 1*/. Do collaborate with your colleagues but submit your individual program.
In this exercise we explore statements used to process character variables. The functions are ||, trim, tranwrd, compress and index.
Exercises
1.
2. 3. 4.
5. 6.
7. 8. 9.
10.
Make sure that all output does not display the date and the page numbers, but the title contains your first and last name, ¡°STAT 3094¡± on the next line, and ¡°Inclass #3¡± on the third line.
Use dataset address_complete from CANVAS. Create another permanent dataset address_complete1:
Create a variable called name with values similar to ¡®Ivan Q. Appleton¡¯; Use variables first_name, middle_initial and last_name and concatenation function ||;
Do this another way – create a variable called name2 with values similar to ¡®Ivan Q. Appleton¡¯.(use function compress to remove leading and trailing blanks from first_name and trim function to remove trailing blanks from middle_initial and last_name variables; use the concatenation function ||); Open the data set using viewtable (ie go to the library and double click on the data set). What do you notice that is different between the two variables name and name2?
Create a PID variable from email_add variable using function tranwrd to replace ¡®@vt.edu¡¯ with ¡®¡¯; i.e. with a blank.
Create a new email address ¡°new_email¡± using function tranwrd to replace ¡®@vt.edu¡¯ with ¡®@virginiatech.edu¡¯;
Create a variable ¡°period_location¡± using the function index that tells you the location of the ¡°.¡± in variable name;
Create a variable ¡®period_location2¡¯ using the function index to identify the location of the ¡°.¡± in variable name2;
What is the difference between period_location and period_location2. Why is there a difference? Perhaps have a look at the data in viewtable to see if you can see the difference in name and name2.
Similarly try using compress rather than trim in (4) and (7) and then apply the index function to identify the location of the period. Why does this give a different answer than the approach with trim.

11. What would function compress do to a first name like ¡°Mary Jane¡±? Write SAS code to see what happens.