1 / 24

The Overseas Chinese Association for Institutional Research Friday SAS Salon

The Overseas Chinese Association for Institutional Research Friday SAS Salon. Annie Lin Associate Data Specialist University of Massachusetts Boston Robert W. Zhang Associate Director of Institutional Research Bowling Green State University AIR 46 th Forum Chicago, IL May 18, 2006.

clio
Download Presentation

The Overseas Chinese Association for Institutional Research Friday SAS Salon

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Overseas Chinese Association for Institutional ResearchFriday SAS Salon Annie LinAssociate Data SpecialistUniversity of Massachusetts BostonRobert W. ZhangAssociate Director of Institutional ResearchBowling Green State University AIR 46th Forum Chicago, IL May 18, 2006

  2. OCAIR General Information established in May 1996 16 members in 1996-97 SIG from 1996 to 1998 affiliated to AIR in October, 1998 OCAIR website:http://www.ocair.org/ OCAIR listserv: ocair@airweb2.org OCAIR song: Ode to OCAIR OCAIR logo:

  3. OCAIR On-line Activities OCAIR exists primarily on the Internet. The on-line activities include 1. Virtual conference & best paper selection 2. On-line workshop 3. IR skill contest 4. Willard’s abstract corner 5. Friday SAS Salon 6. Friday SPSS Tea Room

  4. Friday SAS Salon SAS Salon started in October, 2004. Purpose: To provide a virtual space for SAS discussion To encourage SAS veterans to exchange their successful experiences To attract novices to improve their SAS skills quickly Method: listserv web site

  5. Friday SAS Salon Topics: The discussion on which SAS techniques or procedures could be most efficiently used in IR related projects The comparison of the SAS with SPSS, Access, Excel, etc., in solving the same problem. The exchange of the SAS new features. Sub topics: reading/importing external files to SAS data set data manipulation/calculation statistical procedures macro statements ods (Output Delivery System) function usages

  6. Hot topics & SAS Codes Read Excel spreadsheet directly from an opening file through DDE filename course dde 'Excel|c:\clas\[class.xls]Sheet1!r2c1:r961c3'; data clas; infile course dlm='09'x notab dsd missover lrecl=999 end=eof; length yrterm $5. section $12. enrolled 3. ; input yrterm $ section $ enrolled ;

  7. Hot topics & SAS Codes 2.Join statements in PROC SQL procedure PROC SQL; SELECT * FROM ONE NATURAL JOIN TWO; QUIT; PROC SQL; SELECT * FROM ONE CROSS JOIN TWO; QUIT; PROC SQL; SELECT * FROM ONE UNION JOIN TWO; QUIT;

  8. Hot topics & SAS Codes 3. SAS V9 new feature: CAT functions. data cat; length a b c $10; n=9; a='makes'; b='it'; c='easier'; old=n||a||b||c; new=cat(n,a,b,c); oldtrim=n||trim(a)||trim(b)||c; newtrim=catt(n,a,b,c); newtrim2=cats(n,a,b,c); oldstrp=n||''||trim(a)||''||trim(b)||''||c; newstrp=catx('',n,a,b,c); run;

  9. Hot topics & SAS Codes 4. Usage of macro %str() function %let sort=%str (proc sort; by pid; run ;); &sort; %let print=%str (proc print; run ;); &print;

  10. Hot topics & SAS Codes 4. Usage of macro %str() function (Continued) %macro sql(dsn,newfile,var,file,where); proc sql noprint; connect to odbc (dsn=&dsn); create table &newfile as select * from connection to odbc (select &var from &file &where); disconnect from odbc; quit; %mend; %sql(clas,Cls,*,cls033.txt,where ENROLLED > 0); %sql(PtFac,PtFac,pid,"Pt033",where campus = 'MAIN'); %sql(gradast,Gast,pid,"grdast03$",where pid <> ' '); %sql(FtFac,FtFac,%str(PID, Tenure),0304ft,where campus = 'MAIN');

  11. Hot topics & SAS Codes 5.How to calculate term GPA? DATA DAT1; INPUT ID $ 1-7 GRD $ GRDPTS CREDIT; LAGID = LAG(ID); CARDS; 0001738 D 3 3 0001738 A 12 3 0019858 A 16 4 0019858 B 9 3 0019858 C 8 4 0019858 C 6 3 0019994 A 12 3 0019994 A 12 3 0019994 B 9 3 ;

  12. Hot topics & SAS Codes 5.How to calculate term GPA? (Solution 1) PROC SORT; BY ID; DATA NEW(KEEP=ID tmpoint tmhrs tmgpa); ARRAY GG (6) point1-point6; array pp (6) hour1-hour6; DO K = 1 TO 6; SET DAT1; BY ID; IF LAGID NE LAG(ID) THEN GOTO NN; GG(K) = GRDPTS; pp(k) = CREDIT; if k = 1 then do; tmpoint=gg(k); tmhrs=pp(k); end; else do; tmpoint=tmpoint+gg(k); tmhrs=tmhrs+pp(k); end; tmgpa=tmpoint/tmhrs; IF LAST.ID THEN RETURN; END; NN: ; run;

  13. Hot topics & SAS Codes 5.How to calculate term GPA? (Solution 2) proc sort; by id; proc means sum noprint data=dat1; var GRDPTS CREDIT; by id; output out=new2 sum= grdpts credit; data final; set new2; format gpa 5.2; gpa= grdpts/credit; run;

  14. Hot topics & SAS Codes 5.How to calculate term GPA? (Solution 3) PROC SQL; SELECT id, SUM(grdpts) AS point, SUM(credit) AS credit, SUM(grdpts)/SUM(credit) as gpa FORMAT=4.2 FROM dat1 GROUP BY id ORDER BY id; QUIT;

  15. Hot topics & SAS Codes 6.Colpctn (Column %) & Rowpctn (Row %) TABLE ALL GENDER RACE AGE, /* YRTERM=' '*(N PCTN<ALL GENDER RACE AGE>)  */   YRTERM=' '*(N colpctn) /RTS=22 ROW=FLOAT;

  16. SPSS Tea Room Echo Thank you for giving me an SPSS topic for this Friday.  Here's how one can do similar tasks in SPSS, using the crosstab command.  With the optional "/cells" subcommand, one can ask for cell counts, row percentages, and/or column percentages. crosstab ethn sex resdcode by termentr by frtr /cells countcol.

  17. Basic HTML Code: How to create your first web page: 1. Open your notepad, then copy and paste the following html code: <html> <title>My first html page</title> <body bgcolor=sandybrown> <b><h2><font color=red>This is my first web page</font></h2></b><br><br><br><br> <b><h1><font color=blue>I would like to create more web pages</font></h1></b><br><br><br><br> <font size=5 color=Darkviolet><marquee direction=right loop=infinite scrolldelay="150">More web pages are coming...</marquee></font> </body> </html> 2. Use Save as to save the file as ‘myfirstwebpage.html’ and choose the save as type as ‘all files’. 3. Open myfirstwebpage.html, your first web page will be created.

  18. Basic ASP code: ASP is a server-sidetechnology which means that the server for your website is the sole controller of whether or not ASP is available to you. ASP is also a product of Microsoft which means it will only run on Microsoft operating systems. If you are using a hosting service or getting some free personal web space with your ISP you will want to check with them to see if ASP is available to you. 1. Open notepad, type the following code: <%@language=“VBSCRIPT”%> <HTML> <HEAD><TITLE>MY FIRST ASP PAGE</TITLE></HEAD> <BODY> I WANT TO CREATE MY FIRST ASP PAGE </BODY> </HTML> 2. SAVE AS MYFIRSTASPPAGE.ASP, CHOOSE SAVE AS TYPE ‘ALL FILES’ 3. OPEN MYFIRSTASPPAGE.ASP FILE, your first dynamic web page with ASP technology will be created.

  19. VBScript and Access database connection <html><head><title>My – web page</title> <link href="/StyleSheet/myfirstweb.css" rel="stylesheet" type="text/css" media="all"></head><body><div id="primarycontent"><div id="bravefourhundred"> <dim rsIndex dim kbCategory, pgName, DateCreated, pgTitle, strEditor, datCreated, datPub, strLinkHeader StrSQL = "SELECT T.kbCategoryCode, L.CatDescription, T.pgName, T.pgTitle, T.dateCreated, T.author " _& " FROM tblCategories AS T INNER JOIN tblCategoryLookup AS L ON T.kbCategoryCode" _& " = L.kbCategoryCode WHERE t.kbcategorycode=8 ORDER BY T.dateCreated desc; " 'rsIndex.Open strSQL, ConnContent set rsindex=connContent.Execute(strSQL, , adCmdText) rsIndex.movefirst Do while not rsIndex.eof kbCategory=rsIndex("catDescription") pgTitle=rsIndex("pgTitle") pgName=rsIndex("pgName") datCreated=rsIndex("dateCreated") datPub=Year(datCreated) Response.write(strLinkHeader & pgName & "'> " & pgTitle & "</a><span class='todefine'> " & strEditor & ", Editor (" & datPub & ") </span>") rsIndex.movenext Loop rsIndex.Close Set rsIndex=nothing%> </div></div></body></html>

  20. Members Feedback “There are quite few pieces in Friday SAS Salon that I benefited and I know there is a website I can always consult with. Comparison between the methods could be very interesting and a few good examples will always be treasured. Macro and reading data into SAS from various sources are also great topics.” - Quote from an OCAIR Member

  21. Members Feedback “ I am a loyal SAS Salon reader and user. I have learned a lot and used a lot for my projects. I like most Salon topics because all of them are so useful. Every time I saved those codes and I know I will use them sometime. Actually I used majority of them. Those functions, such as upcase, zipcity, and proc transpose are extremely helpful. Only a couple of lines of codes make my life much easier.” - Quote from an OCAIR Member

  22. Discussion

  23. REFERENCEShttp://www.ocair.orghttp://www.ocair.org/files/KnowledgeBase/IRTools.aspREFERENCEShttp://www.ocair.orghttp://www.ocair.org/files/KnowledgeBase/IRTools.asp

  24. Contact Information Annie Lin Associate Data Specialist University of Massachusetts Boston Office of Institutional Research 100 Morrissey Boulevard Boston, MA 02125-3393 Phone: (617) 287-5431 Fax: (617) 287-7173 Email: annie.lin@umb.edu Robert W. Zhang Associate Director of Institutional Research Bowling Green State University Office of Institutional Research 708 East Wooster Street Bowling Green, OH 43403-0087 Phone: (419) 372-6014 Fax: (419) 372-5315 Email: rzhang@bgsu.edu

More Related