SAS lecture - week 31 Some Basics of CQUEST The operating system in the ESC lab (1046) is Linux. The operating system in RW labs (107/109 and 211) is Windows.

Slides:



Advertisements
Similar presentations
Summary Statistics/Simple Graphs in SAS/EXCEL/JMP.
Advertisements

Lab III – Linux at UMBC.
The INFILE Statement Reading files into SAS from an outside source: A Very Useful Tool!
Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Jump to first page Unix Commands Monica Stoica Jump to first page Introduction to Unix n Unix was born in 1969 at Bell Laboratories, a research subdivision.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
Today: Run SAS programs on Saturn (UNIX tutorial) Runs SAS programs on the PC.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux & Applications Sean GavinWayne State University multi-user environment -- log in: user name and password -- you never turn the computer on or off.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 4P. 1Winter Quarter Introduction to UNIX.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Or CMD/BATCH.  Title this comand makes the cmd prompt’s title whatever you would like it to be.
Agenda What is Computer Programming? The Programming Process
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
Introduction to SAS BIO 226 – Spring Outline Windows and common rules Getting the data –The PRINT and CONTENT Procedures Manipulating the data.
®® Microsoft Windows 7 for Power Users Tutorial 13 Using the Command-Line Environment.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
ECT 250: Survey of E-Commerce Technology FrontPage Publishing pages Unix.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
FTP Server and FTP Commands By Nanda Ganesan, Ph.D. © Nanda Ganesan, All Rights Reserved.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Chapter 1: Introduction to SAS  SAS programs: A sequence of statements in a particular order  Rules for SAS statements: –Every SAS statement ends in.
Getting started: Basics Outline: I.Connecting to cluster: ssh II.Connecting outside UCF firewall: VPN client III.Introduction to Linux IV.Intoduction to.
Diagnostic Pathfinder for Instructors. Diagnostic Pathfinder Local File vs. Database Normal operations Expert operations Admin operations.
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
1 EPIB 698E Lecture 1 Notes Instructor: Raul Cruz 7/9/13.
Unix and Samba By: IC Labs (Raj Kidambi). What is Unix?  Unix stands for UNiplexed Information and Computing System. (It was originally spelled "Unics.")
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
STA302/ SAS lecture1 Some Basics of CQUEST The operating system in RW labs (107/109 and 211) is Windows XP. There are a few terminals in RW 213 running.
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
Introduction to Unix (CA263) File Editing By Tariq Ibn Aziz.
Introduction to Programming Using C An Introduction to Operating Systems.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Linux Commands C151 Multi-User Operating Systems.
MySQL Getting Started BCIS 3680 Enterprise Programming.
Introduction to SAS/willow (Unix) Sam Gordji Weir 107.
More on Using onyx 8/28/13. Program 1 Due a week from today. See website for details.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
XP New Perspectives on Microsoft Windows XP Tutorial 2 1 Microsoft Windows XP Working with Files Tutorial 2.
CSE 1320 Basics Dr. Sajib Datta
Dr. Sajib Datta Jan 16,  The website is up.  Course lectures will be uploaded there ◦ Check regularly for assignments and update.
1 EPIB 698C Lecture 1 Instructor: Raul Cruz-Cano
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
MySQL Getting Started BCIS 3680 Enterprise Programming.
Learning Unix/Linux Based on slides from: Eric Bishop.
Assignprelim.1 Assignment Preliminaries © 2012 B. Wilkinson/Clayton Ferner. Modification date: Jan 16a, 2014.
Introduction to Unix for FreeSurfer Users
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Tutorial of Unix Command & shell scriptS 5027
CS1010: Intro Workshop.
Development Environment Basics
Andy Wang Object Oriented Programming in C++ COP 3330
Assignment Preliminaries
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Chapter 1: Introduction to SAS
Tutorial of Unix Command & shell scriptS 5027
Andy Wang Object Oriented Programming in C++ COP 3330
Linux Shell Script Programming
Module 6 Working with Files and Directories
Running a Java Program using Blue Jay.
Instructor: Raul Cruz 9/4/13
CSCE 206 Lab Structured Programming in C
Presentation transcript:

SAS lecture - week 31 Some Basics of CQUEST The operating system in the ESC lab (1046) is Linux. The operating system in RW labs (107/109 and 211) is Windows XP. In all labs, SAS is run from a Linux Server. Your account is the same and files are accessible in all labs. To logout in ESC: look under System To logout in RW: look under Start In ESC, if you want a terminal window you can either right click on the desktop or click on Applications and then Accessories. In RW, if the backspace doesn’t work in SAS, turn off Num Lock.

SAS lecture - week 32 Using SAS: Batch vs Window Mode In both ESC and RW labs SAS run in a Windows mode. In a window mode you can have access to SAS help and have a better control of graphics. On the other hand, SAS help isn’t great and to be able to use Window mode you either need to purchase site license or be in CQUEST lab. If you wish to use SAS on CQUEST from home you will need to use batch mode which require learning some Unix commands.

SAS lecture - week 33 Starting SAS Window Mode In ESC, under Applications choose CQUEST and then SAS or type sas at a comand prompt in a terminal window. In RW, under Start choose Statistics Apps and then SAS. You will have to enter your CQUEST password. Many windows will open including:  a program editor where you type your SAS program.  a log window (. log file)  an output window (. lst file)  An explorer for navigating through your windows and output  a graphic window will open once you have run a program that produces graphic plots

SAS lecture - week 34 How to Run a Program There are two ways to run a program in SAS… You can type your code in the program editor window, make this window your primary window (click on it) and then click on the running man. The code will disappear. To get it back under Run select Recall last submit. Alternatively, you can write your SAS program in a text file and save it in your home directory. In the explorer window (in SAS) find the file under the directory you save it and double click on it. A new window with your text file will open. You can then highlight the code you wish to run and past it into the program editor window. Running a program writes output to a log window, an output window (if the program ran without errors) and sometimes graphic window. The SAS log window (or.log file) contain messages from SAS about your program written when you run it. Always check it for Errors.

SAS lecture - week 35 Batch Mode Batch mode is useful when working at home by using ssh to access CQUEST at login.cquest.utoronto.ca. To use batch mode in a lab you need to open a terminal window. Using batch mode require to know some Unix. There is no access to SAS help files when using batch mode.

SAS lecture - week 36 Running SAS Programs in Batch Mode Store your program in a text file called filename.sas and at a command prompt type sas filename. This creates filename.log and, if there were no errors in your program, filename.lst. If your data are in a separate file, you need to first save the data in a text file on your CQUEST account under the same directory where your program is stored. In ESC, graphics will pop up in a new window on the screen. To save or print graphic plots, see the SAS code on slide 14. Note also, that to print files on CQUEST at home you will have to first ftp them to your home computer. If any of your SAS batch jobs have a problem and keep running, you must kill them. Type ps at a prompt tp get the number of the SAS job (the PID ), and then type kill -9 thePIDnumber to kill a job.

SAS lecture - week 37 Basic of SAS Programming Every line ends with a semi-colon (;). SAS is not case sensitive; HadaS and hadas are the same withing a program. Anything between /* and */ is a comment. A typical SAS program has data steps (to create and manage your database) and procedures starting with the reserved word proc. The last line of the program should be run ;. You can add titles to your output with the command title ‘This is my title’; at the beginning of your program or within any procedure. SAS has crazy ideas about line lengths. To fix this make options linesize = 79; the first line of your program. (There are many other options you can set, but this is the only one that is essential.) Every line ends with semi colon.

SAS lecture - week 38 The Data Step The code below create a dataset called snow. The data are read from the file gauge.txt. The data file is just a text file, with a new line for each observation. Because the first line of the data file contains the names of the variables and not data, we need to specify firstobs=2. data snow; infile ‘gauge.txt’ firstobs=2 ; input density gain; loggain=log(gain); run; If using MSWindows version of SAS at home, you will need to specify the entire file path to the data in your SAS program.

SAS lecture - week 39 More on the Data Step The code below creates a new dataset which starts with the data set snow but only includes observations for which the density is less than 0.6. data lesssnow; set snow; if density <0.6; To download a data file from the web onto your CQUEST account, right click and save (under This Frame if the data are within a frame). For more instructions on constructing and manipulating SAS datasets see the hand-out posted on the course webpage.

SAS lecture - week 310 Some SAS Procedures By default any procedure operates on the last dataset you created. To change this, add data = dataset_name on any proc line before the semi colon. Proc gplot - Graphic plots go into a graphic window (from which they can be printed or saved individually). For a variable1 versus variable2 scatterplot : Proc gplot; plot variable1*variable2;  Proc print ; print the contents of the last dataset;  Proc corr; prints summary statistics and pairwise correlations for all quantitative variables.

SAS lecture - week 311  Proc univariate plot; var variable_name; Gives many summary statistics and basic plots (or no plots if you leave out the word plot ). If you add the word normal SAS will do a few normality tests. The minimum commands for regression where variable1 is the independent variable and variable2 is the dependent variable: Proc reg; model variable2= variable1; Proc glm can also be used for regression but has fewer options.

SAS lecture - week 312 More on Proc Reg There are many more commands you can add to all procedures, but we will focus on proc reg. More will arise in class as needed but here are some commonly used plotting commands: proc reg simple; model y=x; plot y*x; /*scatterplot with fitted line*/ plot r.*x; /*plot of residuals vs x */ plot r.*p; /*plot residuals vs predicted */ The keyword simple gives basic summary statistic for y and x. Note that the plots produce within proc reg are graphics plots. To produce non-graphics plots; add the keyword lineprinter on the proc reg line. Variable names that end in a period are variables created by SAS.

SAS lecture - week 313 Saving Residuals and Predicted Values Saving residuals and predicted values to a dataset is useful if you want to do more analysis on the residuals or plot them. The following code creates a new dataset called outdata that includes all the variables in the original dataset plus variables called pred (the predicted values) and resid (the residuals). Proc reg; model variable2=variable1; output out=outdata p=pred r=resid;

SAS lecture - week 314 Saving Graphics Plots to a File In SAS window mode, make the graphic window your primary window, choose File from the toolbar and then to print select Print or to save select Export as Image. If you are working at home by using ssh to access CQUEST you will want to save graphic plots in files within the SAS program so that you can sftp them to your home computer or print them when you come to campus. The following commands save graphics plots in gif format to files in your home directory. filename grafout ‘.’; goptions device=gif gsfname=grafout; The file are named by the SAS procedure that created them. For example, if you have requested 3 plots within proc reg the plots will be stored in the files reg.gif, reg1.gif, and reg2.gif. Instead of gif you can specify jpeg and other image formats.

SAS lecture - week 315 Example – Smoking and Cancer Option ls=79; /* Data within program rather than in separate file*/ Data smoking; Input occupational_group $ smoking mortality; Datalines; Farmers_foresters_fisherman Miners_quarrymen Gas_coke_chemical_makers Glass_ceramics_makers ; Proc corr data = smoking; /*Change plotting symbol to a black dot*/ Symbol1 v=‘dot’;

SAS lecture - week 316 Proc gplot; plot mortality*smoking; Proc reg data = smoking; model mortality = smoking; plot mortality*smoking; plot r.*smoking; plot r.*p. Run; Note that there are no semi-colon after each of the data lines, but just one at the end. To save space for this example, I have left out most of the data. The full dataset is on the course website. Also, note that since occupational_group is character data there is a $ after its name in the input statement.

SAS lecture - week 317 A Few Unix Commands These can be executed from a terminal window in ESC or from home when accessing CQUEST through ssh. exit – Logs you off. Passwd – Change your password. Man command – Unix help for command ls – List the files in the current directory. mkdir directory_name – Make a new directory. cd directory_name – Changes directory to directory_name. cd – Changes to your home directory. less file_name – Display the content of file_name on your screen (q to quit). rm file_name – remove file_name. cp file_name1 file_name2 – Copies file_name1 to file_name2. mv file_name1 file_name2 – Moves (rename) file_name1 to file_name2.

SAS lecture - week 318 Editors: in ESC lab, try gedit filename (the default editor). filename can be a new file. Gedit is available as Text Editor when you right-click on an existing file. If you are using ssh, try vi filename but first learn a bit about vi. If you google “vi unix editor’ you will find some good tutorials.