M3 Workshop STAT674

M3 Workshop
*********************************************************************************;
***Q1: Fish Data;
*1.1(5 pts): Write the appropriate SAS code to create the following variables in a data
 set called fish based on the data set sashelp.fish;

*1.2: create variables for each of the following;
*(10 pts) – the Species code that is the capitalized first two letters of the species name;
*(10 pts) – Average length of each fish based on the 3 length measurements provided;
*(10 pts) – Weight per unit of length (weight divided by average length) of each fish;
*(10 pts) -Approximate volume of the fish based on the average length, width and height of
      each fish.  Assume volume = length times width times height times 2/5;


*1.3(10 pts):  Using logical control, create a categorical variable for the weight of fish, where
   – under-weight: less than 120,
   – acceptable weight: between 120 and 650,
   – over-weight: more than 650.
Pay attention to how missing values are handled
Pay attention to lengths of character variables when created;

*1.4(5 pts): Create a second data set based on the first data set that is a subset of the data that contains only Bream and Smelt;


***Q2;

*2.1(5 pts): Write the appropriate code to import the data set 03_workshop_data.csv;

*2.2: Write the code to create the following variables:
   *(10 pts) – Ship date: based on the month, day and year in the data set.;
   *(10 pts) – Compute the total sales amount of 93, 94 and 95
   *(5 pts) You can either use expression to add, or use the sum() function. Which method did you choose to do this? Why? ;
*2.3(10 pts): The shipping code in the data is a character variable. Create a numeric code with values
     * 1 for Next day, 2 for second day, 3 for third day, 4 for next week;
    
*2.4: Bonus question (optional)(Bonus 5pts, full points up to 100pts):
     * create another ship date variable based on the ship date you created in 2.2. This new ship date aligns
       all the original ship dates to the end of the month. e.g. both Apr 20, 1993 and Apr22, 1993 would result in Apr 30,1993.
       Apply a date format to your variable and check the result.
       hint: use INTNX function;


 

 

Click here to order similar paper @Udessaywriters.com.100% Original.Written from scratch by professional writers.

You May Also Like

About the Author: admin