dataset1 - Building a SAS Data Set - 1 List Input reading...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Building a SAS Data Set --- 1 List Input – reading raw data separated by space Example 1.1 (deal with missing values) data listinp; input id height weight gender $ age; datalines; 1 68 144 M 23 2 78 202 M 34 3 62 99 F 37 4 61 101 F 45 ; proc print data=listinp; title 'Example 1.1'; run; Example 1.1 09:15 Tuesday, August 8, 2000 1 OBS ID HEIGHT WEIGHT GENDER AGE 1 1 68 144 M 23 2 2 78 202 M 34 3 3 62 99 F 37 4 4 61 101 F 45 datalines; 1 68 144 M 23 2 . 202 M 34 3 62 99 F 37 4 61 101 F 45 ;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Delimiter--reading raw data separated by commas etc Example 1.2 (reading data separated by delimiters) data commas; infile datalines dlm=','; input id height weight gender $ age; datalines; 1,68,144,M,23 2,78,202,M,34 3,62,99,F,37 4,61,101,F,45 ; proc print data=commas; title 'Example 1.2'; run; The output of this SAS program is identical to the last one. Informat – informat statement and format modifier
Background image of page 2
Example 1.3a (informat statement) data informs; informat lastname $ 20. dob mmddyy8. gender $ 1.; input id lastname dob height weight gender age; format dob mmddyy8.; datalines; 1 Smith 1/23/66 68 144 M 23 2 Jones 3/14/60 78 202 M 34 3 Doe 11/26/47 62 99 F 37 4 Washington 8/1/70 61 101 F 45 ; proc print data=informs; title 'Example 1.3a';
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

dataset1 - Building a SAS Data Set - 1 List Input reading...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online