Presentation is loading. Please wait.

Presentation is loading. Please wait.

Knowing Understanding the Basics Writing your own code SAS Lab.

Similar presentations


Presentation on theme: "Knowing Understanding the Basics Writing your own code SAS Lab."— Presentation transcript:

1 Knowing Understanding the Basics Writing your own code SAS Lab

2 Tutorials Parts 1 and 2 review  What are Libraries?  What are they essentially used for?  What is the Editor (& Enhanced Editor) for?  What is the Output window for?  What is the Log for?

3 Explorer/Results  Why do we look in the Explorer window?  Why do we look in the Results window?

4 Practice Step 1  Open SAS and Create a New Dataset called ‘Fitness’  Use this file:  K:\tsupra\MARK 2042\fitness.txt

5 Variables  If we were using Excel, think of these as the column headings  Not static – i.e. weight  You can create new ones based on variables that already exist – i.e. weight2  Assign values to variables  Var = Immigrant  Values: 1=yes0=no

6 Observations  If this were Excel, we would call these ‘rows’  If this were Access, we would call these ‘records’  How many Observations are in the dataset ‘Fitness’?

7 Practice Step 2 – create Fitness dataset copy  Write another dataset with the (same name) ‘Fitness’ to a new library ‘Work’  Data work.fitness;  Open dataset Fitness from sasuser library to get observations.  set sasuser.fitness;  Highlight and Run This  Look in libraries to see that (working copy) datasets are there

8 Create a new variable in an existing dataset  Make a variable ‘weight2’ that converts kilograms (from the weight variable) to pounds at a 2.2046 rate  Comment:  /*convert variable weight from kg to lbs*/  Syntax:  weight2 = 2.2046*weight;  Highlight and run. What happened? Why?

9 The Output Window YYYYou may only view, print or save TTTTo edit: save as.txt file and do the changes in MS Word WWWWorks in conjunction with the Results window

10 Procedures (Descriptive Statistics)  What is PROC FREQ for?  proc freq data = work.fitness; table group; run;

11 Procedures (Descriptive Stats) cont…  What is PROC MEANS for?  proc means data = work.fitness; var age weight2; run;

12 Procedures (Descriptive Stats) cont…  What is PROC CONTENTS for?  proc contents data = work.fitness; run;

13 Practice Step 3 – do it again!  Generate a dataset ‘MyGrade’ with the following specs:  Variables: Age, CourseCode, CurGPA, TargGrd  Assign values to Var TargGrd:  A+=0, A=1, B=2  Create 3 Observations  Put into the sasuser library  Highlight and run this  Check log and libraries to see that you successfully completed the task

14 MyGrade continued…  Create a working copy of MyGrade in the Work Library.  Make a variable ‘newGPA’ that converts your current course grade point average (from the CurGPA variable) to an International level of GPA * at a 1.75 rate  * This is fictional

15 MyGrade continued…  Generate Output (including an HTML file) for the 1.contents of the data. 2.Means of the data based on the variables of _____ and _____. 3.Frequency of the data based on the _____. 4.FILL IN THE BLANKS, highlight and RUN. (what makes most sense?)

16 Knowing Writing your own Code


Download ppt "Knowing Understanding the Basics Writing your own code SAS Lab."

Similar presentations


Ads by Google