*Use tab-delimited text files fall8.txt, fall9.txt, fall10.txt from website; filename cohort08 ('d:\stat 541\fall8.txt' 'd:\stat 541\fall9.txt' 'd:\stat 541\fall10.txt'); data all; infile cohort08 dlm='09'X missover dsd truncover; input major :$38. degree :$16. class :$9. cltotgpa gender $ nobs; run; /* Alternatively, in SAS Studio, upload data files into folder and then: */ filename cohort08 ("/home/davidhitchcock/sasuser.v94/stat541/Fall8.txt" "/home/davidhitchcock/sasuser.v94/stat541/Fall9.txt" "/home/davidhitchcock/sasuser.v94/stat541/Fall10.txt"); data all; infile cohort08 dlm='09'X missover dsd truncover; input major :$38. degree :$16. class :$9. cltotgpa gender $ nobs; run; *Create separate data sets by year; data fall08 fall09 fall10; set all; if _n_ le 3364 then output fall08; else if _n_ le 6728 then output fall09; else output fall10; run; proc print data=fall09; run; *stimer and fullstimer--fall09 should be a permanent SAS data set; options stimer; data fall2009; set fall09; proc sort data=fall2009; by nobs; run; data fall08 fall09 fall10; set all; if _n_ le 3364 then output fall08; else if _n_ le 6728 then output fall09; else output fall10; run; options fullstimer; data fall2009; set fall09; proc sort data=fall2009; by nobs; run; *Chapter 20--see buffer size, number of pages, observations/page; *Check several options for buffer size and # of buffers; options fullstimer; data svrtdist; set sashelp.svrtdist; run; proc contents data=svrtdist; run; data svrtdist (bufsize=6144 bufno=2); set sashelp.svrtdist; run; data svrtdist (bufsize=8192 bufno=8); set sashelp.svrtdist; run; data svrtdist (bufsize=2048 bufno=4); set sashelp.svrtdist; run; proc contents data=svrtdist; run; * Code to import data set that I have saved in a folder ; * I generated this using the Import Data menu choice; /* Generated Code (IMPORT) */ /* Source File: MedDB.csv */ /* Source Path: /home/davidhitchcock/sasuser.v94/stat541 */ /* Code generated on: Thursday, January 28, 2016 10:25:22 PM */ %web_drop_table(WORK.MEDDB); FILENAME REFFILE "/home/davidhitchcock/sasuser.v94/stat541/MedDB.csv" TERMSTR=CR; PROC IMPORT DATAFILE=REFFILE DBMS=CSV OUT=WORK.MEDDB; GETNAMES=YES; DATAROW=2; RUN; PROC CONTENTS DATA=WORK.MEDDB; RUN; %web_open_table(WORK.MEDDB); *Be sure to assign formats to meddb when you import it; proc sql; create table meddb as select ssn format=ssn11., btrim(tos) as tos label='Type of Service', dos format=mmddyy9. label='Date of Service', provider, claim format=dollar11.2 from meddb; quit; proc contents data=meddb; run; *SASFILE example; sasfile meddb load; proc sgplot data=meddb; vbox claim/category=tos; run; proc freq data=meddb; format dos mmddyy10.; where month(dos)=7; table dos*tos/nopercent norow nocol; run; proc sgplot data=meddb; histogram claim/scale=count nofill; density claim/type=kernel; run; sasfile meddb close; proc sgplot data=meddb; vbox claim/category=tos; run; proc freq data=meddb; format dos mmddyy10.; where month(dos)=7; table dos*tos/nopercent norow nocol; run; proc sgplot data=meddb; histogram claim/scale=count nofill; density claim/type=kernel; run;