/* Reading space-delimited data */ DATA scores1; INPUT name $ hw1 hw2 quiz1 quiz2 final; DATALINES; Keenan 9 8 8 6 75 Wu 10 10 9 9 88 Gold 5 5 7 9 78 Williams 10 5 10 9 80 Alonzo 10 10 10 10 95 ; PROC PRINT DATA=scores1; RUN; QUIT; ---------------------------------------------------------------------------------- /* Reading column-formatted data */ DATA scores2; INPUT name $ 1-17 hw1 18-19 hw2 21-22 quiz1 24-25 quiz2 27-28 final 30-31; DATALINES; John W. Keenan 9 8 8 6 75 Ted Wu 10 10 9 9 88 Alicia S. Gold 5 5 7 9 78 Mary P. Williams 10 5 10 9 80 Cesar H. Alonzo 10 10 10 10 95 Crystal Ahn 10 8 8 10 81 Chris Reyes 10 8 8 10 81 ; PROC PRINT DATA=scores2; RUN; QUIT; ---------------------------------------------------------------------------------- /* Reading data from external file */ filename egdata "C:\Users\naranjo\Documents\My SAS Files(32)\nhanes.txt"; DATA health1; INFILE egdata; INPUT gender $ age race $ 19-37 education $ 38-54 fam_inc poverty weight height bmi sys_bp dias_bp cholest glucose; PROC PRINT DATA=health1 (obs=20); VAR gender age race education bmi cholest glucose; /* OPTIONAL */ RUN; QUIT; ---------------------------------------------------------------------------------- /* Reading data from a web page, with FIRSTOBS option (e.g. variable names on first two lines) */ filename egdata URL "http://www.stat.wmich.edu/naranjo/sas/nhanes.txt"; DATA health2; INFILE egdata FIRSTOBS=3; INPUT gender $ age race $ 19-37 education $ 38-54 fam_inc poverty weight height bmi sys_bp dias_bp cholest glucose; PROC PRINT DATA=health2 (obs=20); VAR gender age race education bmi cholest glucose; /* OPTIONAL */ RUN; QUIT;