SAS Certification Examples(part 2)

<Back to Part 1, the first 5 sessions

Back to SAS Certification Examples and Exercises

(Part 2)

Example 1
data test; file 'c:\Temp\myfile.txt'; x=10; y=20; put x; put y; output; x=3; y=36; put x; put y; put 'All done.'; run; Try putting a * in front of the file statement. Run the code clip again and look what's in the LOG.

After making a dataset in SAS, it becomes a temporary .sas7bdat file in a WORK library that is cleared when you close the SAS session.

data test; x=10; y=20; output; run;

Before you close SAS you can simple read it by using a set statement.

Here's an example of reading a plain text file data testds; infile 'c:\Temp\myfile.txt'; input x; run; proc print data=testds; run;

Example 2
Strings

data strings1; infile 'c:\Temp\strings.txt'; input id month $ grade $1. correct total; run; proc print data=strings1; run;

The $1. is an INformat. An informat always has a. (dot) in it.

Without an informat specification on the INPUT statement SAS may have some difficulty determining what length to make the placeholder for the textual information in a column.

data strings1; infile 'c:\Temp\strings.txt'; input id month $ grade $ correct total; run; proc print data=strings1; run;

To assist SAS with correctly jumping to a column where we expect certain data to reside on each record/row we use pointer control (using the @ sign on the INPUT statement).

data justyr; infile 'c:\Temp\strings.txt'; input @10 yr @13 grade $1. @15 correct total; run; proc print data=justyr; run;

Example 3
Using Informats to do more.

data strings2; input id month $ grade $upcase1. correct total major $20.; cards; 101 10-2006 A 12 14 Economics 101 11-2006 A 15 15 Econ 101 12-2006 B 15 20 economics 101 1-2007 a 15 15 econ 102 10-2006 c 10 14 Psychology 102 12-2006 C 12 20 Psych 102 01-2007 B 13 15 PSYCH 103 10-2006 a 14 14 Econ 103 11-2006 B 12 15 Econ 103 12-2006 B 16 20 Econ 104 01-2007 A 15 15 Decker School of Nursing ; run; proc print data=strings2; run;

Example 4
Using common string functions.

data str3; set strings2; m=substr(month,1,2); maj=substr(major,1,4); l=length(major); lenm=length(month); run; data str4; set strings2; maj=upcase(substr(major,1,4)); run;

Example 4a
A short practical use of converting everything to upper case and using a 'subsetting IF' statement.

data econ; set str4; if (maj='ECON'); run; proc means data=econ; var correct; run; proc print data=econ; run; Other functions (acting on character strings) /* index anylower anyupper if 'a'='A' then do; end; anyspace if upcase('a')=upcase('A') then do; end; */

Example 5
INformats for numbers.

data numbers; input n 4.1 @6 n2 ; cards; 012345678910 8912827384 999999 6666 103 ; run; proc print data=numbers; run;

Closing examples
data stringok; input @21 majorcap $upcase4.; cards; 101 10-2006 A 12 14 Economics 101 11-2006 A 15 15 Econ 101 12-2006 B 15 20 economics 101 1-2007 a 15 15 econ 102 10-2006 c 10 14 Psychology 102 12-2006 C 12 20 Psych 102 01-2007 B 13 15 PSYCH 103 10-2006 a 14 14 Econ 103 11-2006 B 12 15 Econ 103 12-2006 B 16 20 Econ 104 01-2007 A 15 15 Decker School of Nursing ; run; proc print data=stringok; run; data stringweird; input @21 majorcap $revers4.; cards; 101 10-2006 A 12 14 Economics 101 11-2006 A 15 15 Econ 101 12-2006 B 15 20 economics 101 1-2007 a 15 15 econ 102 10-2006 c 10 14 Psychology 102 12-2006 C 12 20 Psych 102 01-2007 B 13 15 PSYCH 103 10-2006 a 14 14 Econ 103 11-2006 B 12 15 Econ 103 12-2006 B 16 20 Econ 104 01-2007 A 15 15 Decker School of Nursing ; run; proc print data=stringweird; run;

Session 7
No data for today. We'll use datasets in the SASHELP library, or files that we explicitly create in class. Be sure to look at the references (listed at 'Essential Readings') for functions and functions by category (to find those listed for SAS Dates and Times). We'll be speaking about date/time related Formats, and Informats today as well.

To look at what's possible with SAS graphics the SAS/Graph overview is an excellent place to start.

In class
data test; x=today; x1=today+1; x2='31DEC1960'D ; x3='02JAN1961'D ; x4='02JAN1961'D +0; x5='02JAN1961'D *1; run; proc print data=test; run; proc contents data=test; run; proc print data=test; format x1 year4. ; format x3 JULDAY3. ; format x4 DATE9. ; run; data test2; set test; format x1 MMDDYYS8. ; format x2 WEEKDATE23. ; format x3 WEEKDAY1. ; run; proc print data=test2; run; proc contents data=sashelp.air; run; proc print data=sashelp.air (obs=10); format date WEEKDATE23. ; var date; run; *date_. monyy. ddmmyy__. WEEKDATE__. WEEKDAY1. JULDAY3. YEAR4. ; data test3; set sashelp.air; day=day(date); mo=month(date); run; data test4; dob='07JUL1980'D ; t=today; *yearsold=intck(year,dob,t); yrsapprox=(t-dob)/365; run; proc print data=test4; run; * DATDIF INTCK; data test5; m=6; d=3; y=1960; sasda=mdy(m,d,y); run; proc print data=test5; format sasda date9.; run; * AIR CITIYR CITIDAY; data class2; set sashelp.class; run; ods html; ods graphics on; proc reg data=class2; model height=weight; run;

Session 8
Test score data

101	57 102	52 104	87 105	69 106	62 107	75 108	41 109	41 110	79 111	25 119	36 118	82 114	41

Example 1
for arrays

Baseball YANKS,0,0,0,0,1,2,0,0,1 METS, 0,0,0,0,0,1,0,1,1

Example 2
Soup data

North,Johnson City,CHICKRICE,CHICKRICE,CHICKRICE,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKGARL,CHICKGARL,CHICKGARL,POTATOGARL,POTATOGARL,TOMATO,TOMATO,TOMATO,TOMATO,TOMATO,TOMATO,TOMATO,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,MINESTRONE,MINESTRONE,LENTIL,MEATPAST,BEEFBAR,ITALIANWED,CLAMCHOWNE,CLAMCHOWFF,SAUSPEPP,SAUSPEPP,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,SPLITPEAHAM,SPLITPEAHAM,,,,,,, Main,Binghamton,CHICKVEG,CHICKRICE,CHICKRICE,CHICKRICE,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKGARL,CHICKGARL,CHICKGARL,POTATOGARL,POTATOGARL,TOMATO,TOMATO,TOMATO,TOMATO,TOMATO,TOMATO,TOMATO,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,MEATPAST,BEEFBAR,ITALIANWED,CLAMCHOWNE,CLAMCHOWNE,SAUSPEPP,SAUSPEPP,SAUSPEPP,SAUSPEPP,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,SPLITPEAHAM,,,,,,,,, North,Endwell,CHICKMEX,CHICKMEX,CHICKMEX,CHICKMEX,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKRICE,CHICKRICE,CHICKALF,CHICKALF,CHICKALF,CHICKALF,CHICKALF,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKVEG,CHICKVEGMED,CHICKVEGMED,CHEESERAV,VEGMED,VEGMED,VEGMED,VEGMED,POTATOGARL,POTATOGARL,TOMATO,TOMATO,TOMATO,TOMATO,MINESTRONE,POTATOBROCC,POTATOBROCC,POTATOBROCC,LENTIL,MEATPAST,MEATPAST,BEEFVEG,ITALIANWED,ITALIANWED,ITALIANWED,CLAMCHOWNE,SAUSPEPP,SAUSPEPP,SAUSPEPP,BEANHAM,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM, Main,Vestal,CHICKMEX,CHICKMEX,CHICKMEX,CHICKMEX,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKRICE,CHICKRICE,CHICKALF,CHICKALF,CHICKALF,CHICKALF,CHICKALF,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKVEG,CHICKVEGMED,CHICKVEGMED,CHEESERAV,VEGMED,VEGMED,VEGMED,VEGMED,POTATOGARL,POTATOGARL,TOMATO,TOMATO,TOMATO,TOMATO,MINESTRONE,POTATOBROCC,POTATOBROCC,POTATOBROCC,LENTIL,MEATPAST,MEATPAST,MINESTRONE,MINESTRONE,MINESTRONE,TOMATO,TOMATO,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWFF,CLAMCHOWFF,BEANHAM,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM Jenson,Binghamton,CHICKRICE,CHICKRICE,CHICKRICE,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKGARL,CHICKGARL,CHICKGARL,POTATOGARL,POTATOGARL,TOMATO,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,MINESTRONE,MINESTRONE,LENTIL,MEATPAST,BEEFBAR,ITALIANWED,CLAMCHOWNE,CLAMCHOWFF,SAUSPEPP,SAUSPEPP,BEANHAM,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,BEANHAM,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,,,,,,,,, Court,Binghamton,CHICKVEG,CHICKRICE,CHICKRICE,CHICKRICE,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKGARL,CHICKGARL,CHICKGARL,POTATOGARL,POTATOGARL,CHICKWILD,CHICKWILD,CHICKWILD,CHEESERAV,CHEESERAV,CHEESERAV,MINESTRONE,MINESTRONE,MINESTRONE,MINESTRONE,MINESTRONE,POTATOBROCC,POTATOBROCC,POTATOBROCC,LENTIL,LENTIL,LENTIL,LENTIL,LENTIL,MEATPAST,MEATPAST,BEEFBAR,BEEFBAR,BEEFBAR,BEEFBAR,CLAMCHOWNE,CLAMCHOWNE,BEANHAM,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,,,, Front,Binghamton,LENTIL,LENTIL,LENTIL,BEEFBAR,BEEFBAR,VEGMED,VEGMED,VEGMED,SAUSPEPP,SAUSPEPP,SAUSPEPP,SAUSPEPP,VEGMED,ITALIANWED,CLAMCHOWNE,CLAMCHOWFF,BEANHAM,BEANHAM,SPLITPEAHAM,CHICKNOOD,CHICKRICE,CHICKALF,CHICKWILD,CHICKWILD,CHICKPENNE,MEATPAST,MEATPAST,MEATPAST,MINESTRONE,CHICKALF,VEGMED,VEGMED,POTATOGARL,POTATOGARL,POTATOGARL,,,,,,,,,,,,,,,,,,,,,, Main,Endicott,CHICKNOOD,CHICKNOOD,CHICKVEGMED,CHICKNOOD,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKGARL,CHICKGARL,CHICKGARL,POTATOGARL,POTATOGARL,CHICKWILD,CHICKWILD,CHICKWILD,CHEESERAV,CHEESERAV,CHEESERAV,MINESTRONE,MINESTRONE,MINESTRONE,MINESTRONE,MINESTRONE,POTATOBROCC,POTATOBROCC,POTATOBROCC,LENTIL,LENTIL,LENTIL,LENTIL,LENTIL,TOMATO,TOMATO,MEATPAST,MEATPAST,BEEFBAR,BEEFBAR,BEEFBAR,BEEFBAR,CLAMCHOWFF,CLAMCHOWFF,CLAMCHOWNE,CLAMCHOWNE,BEANHAM,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,,,,,,,, Grand Ave,Johnson City,CHICKRICE,CHICKRICE,CHICKRICE,CHICKRICE,CHICKRICE,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKGARL,CHICKGARL,CHICKGARL,POTATOGARL,POTATOGARL,CHICKWILD,CHICKWILD,CHICKWILD,CHEESERAV,CHEESERAV,CHEESERAV,MINESTRONE,MINESTRONE,MINESTRONE,MINESTRONE,MINESTRONE,POTATOBROCC,POTATOBROCC,POTATOBROCC,LENTIL,LENTIL,LENTIL,LENTIL,LENTIL,MEATPAST,MEATPAST,BEEFBAR,BEEFBAR,BEEFBAR,BEEFBAR,CLAMCHOWNE,CLAMCHOWNE,BEANHAM,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,,,,,,,,,,, Floral,Johnson City,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKRICE,CHICKRICE,CHICKALF,CHICKALF,CHICKALF,CHICKALF,CHICKALF,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKVEG,CHICKVEGMED,CHICKVEGMED,CHEESERAV,VEGMED,VEGMED,VEGMED,VEGMED,POTATOGARL,POTATOGARL,TOMATO,TOMATO,TOMATO,TOMATO,MINESTRONE,POTATOBROCC,POTATOBROCC,POTATOBROCC,LENTIL,MEATPAST,MEATPAST,MINESTRONE,MINESTRONE,MINESTRONE,TOMATO,TOMATO,CLAMCHOWNE,CLAMCHOWNE,TOMATO,,,,,,,,,,,, Floral,Binghamton,CHICKVEG,CHICKRICE,CHICKRICE,CHICKRICE,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKGARL,CHICKGARL,CHICKGARL,POTATOGARL,POTATOGARL,TOMATO,TOMATO,TOMATO,TOMATO,TOMATO,TOMATO,TOMATO,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,CHICKWILD,MEATPAST,ITALIANWED,CLAMCHOWNE,CLAMCHOWNE,SAUSPEPP,SAUSPEPP,SAUSPEPP,SAUSPEPP,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,SPLITPEAHAM,,,,,,,,,, Vestal,Binghamton,CHICKMEX,CHICKMEX,CHICKMEX,CHICKMEX,CHICKMEX,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKRICE,CHICKRICE,CHICKALF,CHICKALF,CHICKALF,CHICKALF,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKVEG,CHICKVEGMED,CHICKVEGMED,CHEESERAV,VEGMED,VEGMED,VEGMED,VEGMED,POTATOGARL,POTATOGARL,TOMATO,TOMATO,TOMATO,TOMATO,MINESTRONE,POTATOBROCC,POTATOBROCC,LENTIL,MEATPAST,MEATPAST,MINESTRONE,MINESTRONE,MINESTRONE,TOMATO,TOMATO,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,BEANHAM,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM, West,Endwell,CHICKNOOD,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKGARL,CHICKGARL,CHICKGARL,POTATOGARL,POTATOGARL,CHICKWILD,CHICKWILD,CHICKWILD,CHEESERAV,CHEESERAV,CHEESERAV,MINESTRONE,MINESTRONE,MINESTRONE,MINESTRONE,MINESTRONE,POTATOBROCC,POTATOBROCC,POTATOBROCC,LENTIL,LENTIL,LENTIL,LENTIL,LENTIL,TOMATO,TOMATO,MEATPAST,MEATPAST,BEEFBAR,BEEFBAR,BEEFBAR,BEEFBAR,CLAMCHOWFF,CLAMCHOWFF,CLAMCHOWNE,CLAMCHOWNE,BEANHAM,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,,,,,,,,,,, First,Binghamton,CHICKNOOD,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKVEGMED,CHICKGARL,CHICKGARL,CHICKGARL,POTATOGARL,POTATOGARL,CHICKWILD,CHICKWILD,CHICKWILD,CHEESERAV,CHEESERAV,CHEESERAV,MINESTRONE,MINESTRONE,MINESTRONE,MINESTRONE,MINESTRONE,POTATOBROCC,POTATOBROCC,POTATOBROCC,LENTIL,LENTIL,LENTIL,LENTIL,LENTIL,MEATPAST,MEATPAST,MEATPAST,MEATPAST,BEEFBAR,BEEFBAR,BEEFBAR,BEEFBAR,CLAMCHOWFF,CLAMCHOWFF,CLAMCHOWNE,BEANHAM,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,TOMATO,,,,,,,,,,, Farr Ave,Vestal,VEGMED,VEGMED,VEGMED,TOMATO,TOMATO,CHICKPENNE,CHICKPENNE,CHICKPENNE,CHICKALF,CHICKALF,CHICKALF,CHICKALF,CHICKMEX,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,POTATOGARL,LENTIL,LENTIL,LENTIL,LENTIL,LENTIL,BEEFBAR,BEEFBAR,BEEFVEG,BEEFVEG,BEEFVEG,BEEFVEG,ITALIANWED,ITALIANWED,ITALIANWED,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWFF,CLAMCHOWFF,CLAMCHOWFF,CLAMCHOWFF,BEANHAM,BEANHAM,SAUSPEPP,,,,,,,,,, Clifford,Binghamton,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,SAUSPEPP,BEANHAM,SPLITPEAHAM,CHICKMEX,CHICKMEX,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKRICE,CHICKRICE,CHICKRICE,CHICKRICE,CHICKRICE,CHICKWILD,CHICKWILD,CHICKPENNE,CHEESERAV,CHEESERAV,CHEESERAV,VEGMED,POTATOGARL,MINESTRONE,MINESTRONE,LENTIL,LENTIL,LENTIL,MEATPAST,BEEFBAR,,,,,,,,,,,,,,,,,,,,,,,,, Maxwell,Johnson City,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKVEG,CHICKVEG,CHICKGARL,CHICKGARL,CHEESERAV,CHEESERAV,CHEESERAV,VEGMED,VEGMED,VEGMED,VEGMED,TOMATO,TOMATO,TOMATO,MINESTRONE,MINESTRONE,POTATOBROCC,LENTIL,LENTIL,MEATPAST,BEEFBAR,BEEFBAR,BEEFBAR,BEEFBAR,BEEFVEG,BEEFVEG,BEEFVEG,BEEFVEG,BEEFVEG,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWFF,SAUSPEPP,SAUSPEPP,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,, Riverside Drive,Binghamton,CHICKNOOD,CHICKVEG,CHICKVEG,CHICKGARL,CHICKGARL,CHEESERAV,CHEESERAV,CHEESERAV,VEGMED,VEGMED,VEGMED,VEGMED,TOMATO,TOMATO,TOMATO,TOMATO,TOMATO,MINESTRONE,MINESTRONE,POTATOBROCC,LENTIL,LENTIL,MEATPAST,BEEFBAR,BEEFBAR,BEEFBAR,BEEFBAR,BEEFVEG,BEEFVEG,BEEFVEG,BEEFVEG,BEEFVEG,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWFF,SAUSPEPP,SAUSPEPP,BEANHAM,BEANHAM,BEANHAM,SPLITPEAHAM,SPLITPEAHAM,SPLITPEAHAM Oak,Endicott,CHICKNOOD,CHICKNOOD,CHICKNOOD,CHICKVEG,CHICKVEG,CHICKGARL,CHICKGARL,CHEESERAV,CHEESERAV,CHEESERAV,VEGMED,VEGMED,VEGMED,VEGMED,TOMATO,TOMATO,TOMATO,MINESTRONE,MINESTRONE,POTATOBROCC,LENTIL,LENTIL,MEATPAST,BEEFBAR,BEEFBAR,BEEFBAR,BEEFBAR,BEEFVEG,BEEFVEG,BEEFVEG,BEEFVEG,BEEFVEG,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,CLAMCHOWNE,SAUSPEPP,SAUSPEPP,BEANHAM,BEANHAM,BEANHAM,,,

Example 3
for PROC TRANSPOSE x,y,z 1,2,3 4,5,6 7,8,9 10,11,12

Example 3A
id,x,y,z 101,1,2,3 101,4,5,6 101,7,8,9 101,10,11,12 102,10000,20000,30000 102,40000,50000,60000 102,70000,80000,90000 102,99999,99999,99999

Example 4
id     date    returns 101 1/1/04     8.1     102  2/1/04     7.2     103  3/1/04     7.3     104  4/1/04     7.9     105  5/1/04    13.7     106  6/1/04    14.6     107  7/1/04    14.8     108  8/1/04    13.7     109  9/1/04    13.9     110 10/1/04    15.1     111 11/1/04    14.9     112 12/1/04    13.7     113  1/1/05    14.5     114  2/1/05    20.2     115  3/1/05      19     116  4/1/05      21     117  5/1/05    26.1     118  6/1/05    26.2     119  7/1/05    25.5     120  8/1/05    26.8     121  9/1/05    25.4     122 10/1/05    26.4     123 11/1/05    25.8     124 12/1/05    26.3     125  1/1/06    26.4     126  2/1/06    32.7     127  3/1/06    31.9     128  4/1/06    32.3     129  5/1/06    31.6     130  6/1/06    37.8     131  7/1/06      39     132  8/1/06      37     133  9/1/06    37.9     134 10/1/06    37.5     135 11/1/06    38.9     136 12/1/06    44.2

Example 1
How to transpose the data? The example from online documentation.

data score; input Student $9. StudentID $ Test1 Test2 Final; datalines; Capalleti 0545  94 91 87 Dubose   1252   51 65 91 Engles   1167   95 97 97 Grant    1230   63 75 80 Krupski  2527   80 76 71 Lundsford 4860  92 40 86 McBane   0674   75 78 72 ; proc transpose data=score out=scoretran; run; proc print data=scoretran; run;

Example 2
Logistic Data

1 ACT   3  NO      2  ACT    3  YES     4  ACT    3  YES 6 ACT   6  YES     7  ACT   15  NO     10  ACT    6  YES 11 ACT   6  YES    14  ACT    6  YES    15  ACT   15  NO  17  ACT  15  NO     20  ACT   12  NO     21  ACT   18  NO  22  ACT   6  YES    25  ACT   15  NO     26  ACT    6  YES 28 ACT  15  NO     29  ACT   12  YES    32  ACT    9  NO  33  ACT   6  YES    36  ACT    6  NO     39  ACT    6  NO  42  ACT   6  NO     44  ACT    3  YES    46  ACT   18  NO  49  ACT   9  NO     50  ACT   12  YES    52  ACT    6  NO  54  ACT   9  YES    56  ACT    9  YES    58  ACT    3  NO  60  ACT   9  YES    62  ACT   12  NO     63  ACT   12  NO  66  ACT   3  NO     67  ACT   12  NO     69  ACT   12  NO  71  ACT  12  NO     73  ACT    9  YES    74  ACT    6  YES 77 ACT  12  NO     79  ACT    6  NO     81  ACT   15  YES 83 ACT   9  NO     85  ACT    3  YES    88  ACT    9  NO  90  ACT   9  NO     92  ACT    9  NO     94  ACT    9  NO  95  ACT   9  YES    98  ACT   12  YES    99  ACT    3  YES 102 ACT   6  YES     3  PBO    9  YES     5  PBO    3  NO   8  PBO  12  YES     9  PBO    3  YES    12  PBO    3  YES 13 PBO  15  YES    16  PBO    9  YES    18  PBO   12  YES 19 PBO   3  YES    23  PBO    9  YES    24  PBO   15  YES 27 PBO   9  YES    30  PBO    6  YES    31  PBO    9  YES 34 PBO   6  YES    35  PBO   12  NO     37  PBO    9  NO  38  PBO  15  NO     40  PBO   15  YES    41  PBO    9  NO  43  PBO   9  NO     45  PBO   12  YES    47  PBO    3  YES 48 PBO   6  YES    51  PBO    6  YES    53  PBO   12  NO  55  PBO  12  NO     57  PBO   12  YES    59  PBO    3  YES 61 PBO  12  YES    64  PBO    3  YES    65  PBO   12  YES 68 PBO   6  YES    70  PBO    6  YES    72  PBO    9  YES 75 PBO  15  NO     76  PBO   15  NO     78  PBO   12  NO  80  PBO   9  NO     82  PBO   12  NO     84  PBO   15  NO  86  PBO  18  YES    87  PBO   12  NO     89  PBO   15  YES 91 PBO  15  NO     93  PBO   15  NO     96  PBO   18  NO  97  PBO  18  YES   100  PBO   18  NO    101  PBO   18  NO

Examples for Model Procedure
pop    year 3.929   1790   5.308    1800   7.239    1810   9.638    1820  12.866    1830  17.069    1840  23.191    1850  31.443    1860  39.818    1870  50.155    1880  62.947    1890  75.994    1900  91.972    1910  105.71    1920 122.775    1930 131.669    1940 151.325    1950 179.323    1960 203.211    1970 226.542    1980  248.71    1990

as a csv pop,year 3.929,1790 5.308,1800 7.239,1810 9.638,1820 12.866,1830 17.069,1840 23.191,1850 31.443,1860 39.818,1870 50.155,1880 62.947,1890 75.994,1900 91.972,1910 105.71,1920 122.775,1930 131.669,1940 151.325,1950 179.323,1960 203.211,1970 226.542,1980 248.71,1990

A second example for parabolic curve
x,y -3,37.4000 -3,37.0000 -3,36.8000 -2,26.2000 -2,26.1000 -2,26.0000 -2,26.0000 -1,16.5000 -1,16.9000 -1,17.0000 -1,17.5000 0,9.9000 0,10.0000 0,9.5000 0,9.9000 1,4.9000 1,5.2000 1,4.5000 1,4.8000 2,2.2000 2,1.5000 2,1.8000 2,2.3000 3,1.4000 3,0.8000 4,1.5000 4,2.5000 4,2.5000