INSTRUCTIONS FOR USING SAS STUDIO This assumes you have already created your SAS Studio account. To do this, click on the link labeled "SAS OnDemand Entry Page" on the course webpage. After going to the entry page, create a student account. You will receive an enrollment link in an email from the course instructor. Once your account is created, you can access SAS Studio by going to the Control Center To begin, choose the "SAS OnDemand Control Center" link on the course webpage. Log in with the username and password you chose when you created your account. Once logged in, Click the link labeled "SAS Studio". It will take a few seconds to get going. Once SAS Studio is up in a new window, you should see a "Server Files and Folders" panel on the left side and a Program Window on the right side. The Program window is where you will type your SAS code. If you want to maximize the Program window, click the "Maximize view" icon on the upper far-right of the Program window. Once your SAS program is typed in the Program Editor window, you run the program. This is done by choosing the "Running man" icon in the program panel's menu, or by pressing the F3 button. (If the SAS code in the Program Editor is erased upon running it, you can, after clicking in the Program Editor window, choose "Recall Last Submit" Under the "Run" Menu (or press F4).) When you run the program, the desired results should appear in the Results window. (If they don't, check the Log Window; there is probably an error.) You can save the program you've written by choosing the save icon in the menu. But I prefer to save the program code outside of SAS (like in a Notepad file or in some other text editor) and then copy/paste the code into the SAS program window when I need to. Having learned where to write the SAS code, how to run the programs, and where to look for the results, let's look at a sample SAS program. Note that when writing SAS code, you can include "comments", text that is not executed by SAS but is merely to help yourself or others understand what the code means. In SAS, lines which begin with an asterisk and end in a semicolon are comments. So are lines which begin with slash-asterisk and end with asterisk-slash. See the following program for examples: /* begin SAS program */ * Whether you type lowercase or uppercase doesn't matter. ; * SAS is not case-sensitive. ; DATA satscore; * The DATA command names the data set ; * The name should begin with a letter and be no more than 8 characters long ; * I give this data set the name "satscore" b/c the data are SAT scores for states; INPUT state $ sat1990 sat2000; /* The INPUT command names the variables (the columns) in the data set */ /* These names should also be 8 characters or less */ /* The variable "state" has a dollar sign after it */ /* This is because it is qualitative (non-numerical) */ /* Any qualitative variable needs a dollar sign */ /* after its name in the INPUT line */ * When the data are typed/copied into the program, the command "cards" tells SAS ; * that the next lines consist of data. ; * We could also use the command "lines" or "datalines" to do the same thing: ; cards; Alabama 1079 1114 Alaska 1015 1034 Arizona 1041 1044 Arkansas 1077 1117 California 1002 1015 Colorado 1067 1071 Connecticu 1002 1017 Delaware 1006 998 D.C. 950 980 Florida 988 998 Georgia 951 974 Hawaii 985 1007 Idaho 1066 1081 Illinois 1089 1154 Indiana 972 999 Iowa 1172 1189 Kansas 1129 1154 Kentucky 1089 1098 Louisiana 1088 1120 Maine 991 1004 Maryland 1008 1016 Massachuse 1001 1024 Michigan 1063 1126 Minnesota 1110 1175 Mississipp 1090 1111 Missouri 1089 1149 Montana 1082 1089 Nebraska 1121 1131 Nevada 1022 1027 NHampshire 1028 1039 NJersey 993 1011 NMexico 1100 1092 NewYork 985 1000 NCarolina 948 988 NDakota 1157 1197 Ohio 1048 1072 Oklahoma 1095 1123 Oregon 1024 1054 Pennsylvan 987 995 RIsland 986 1005 SCarolina 942 966 SDakota 1150 1175 Tennessee 1102 1116 Texas 979 993 Utah 1121 1139 Vermont 1000 1021 Virginia 997 1009 Washington 1024 1054 WestVA 1034 1037 Wisconsin 1111 1181 Wyoming 1072 1090 ; run; /* A COMMENT ABOUT SEMICOLONS */ * Note that just about every line of code ends with a semicolon in SAS ; * The exceptions are the lines of data ; * but there IS a single semicolon at the end of all the data ; * Be careful that your semicolons are all there ; * This is a very common (and easily correctable) cause of errors in SAS ; * If your program has an error, first see if you've left off any semicolons; /* How can we print these data into the Output Window? */ PROC PRINT DATA=satscore; TITLE "SAT Scores from 1990 and 2000 for the 50 States"; RUN; /* The RUN command should appear at the end of this PRINT procedure */ /* or any other SAS procedure */ /* A missing RUN command is another common error -- be careful! */ /* How can we make a scatterplot of these data in the Results Window? */ PROC SGPLOT DATA=satscore; SCATTER y=sat2000 x=sat1990; TITLE "Plot of SAT Scores from 1990 and 2000 for the 50 States"; RUN; /* The TITLE command gives the Output a nice title */ TITLE; /* The single TITLE; line cancels all previous titles for future output. */ /* end SAS program */ The best way to print results is to use one of the icons on the top left of the Results panel. For example, "Download Results as a PDF file" or "Download Results as a RTF file". Then the resulting file can be opened and printed. If you want to edit the file before printing (often a good idea!) or just select pieces of the output for printing, it's better to download it as a RTF file. Then you can open the RTF file in Microsoft Word and edit it, select portions of the output, adjust sizes of graphs, etc., before printing. In order to have results available as RTF, make sure this "RTF output" option is checked by going to: "More application options" icon in right side of top blue bar --> Preferences --> Results tab --> Check "Produce RTF output"