99.DLM | INFILE | DATALINES | INPUT | LABEL | IF THEN OUTPUT STATEMENT

DLM | INFILE | DATALINES | INPUT | LABEL | IF THEN OUTPUT STATEMENT


data tutor; 

  infile datalines dlm=',';

  input faculty_ID  Department:$36. Satisfaction_with_Department 

        Years_Employed_at_University  Status$   Degree$ Date:mmddyy10.;

  label faculty_ID='ID'

        Department='Dept'

Satisfaction_with_Department='Satisfaction With Department'

        Years_Employed_at_University="Years Employed at University"

Status="Status"

Degree="Degree";

  format date date9.;

  datalines;

  1,Anthropology,5,20,T,D,02/12/2007

  2,Family and Consumer Studies,4,15,NT,M,03/18/2007

  3,Communication Studies,2,5,NT,M,05/05/2008

  4,Speech Pathology and Audiology,5,5,PT,M,11/24/2007

  5,Nursing,2,22,T,D,09/06/2007 

  6,English,5,27,T,D,04/25/2007

  7,Nursing,3,13,NT,M,10/16/2007

  8,Economics,2,8,NT,M,01/08/2008

  9,History,4,5,PT,B,01/09/2007

 10,Finance,3,7,T,D,01/10/2008

 11,Mathematical Studies,5,16,T,D,06/11/2008

 12,Accounting,4,18,T,D,05/18/2008

 13,Psychology,2,9,T,D,02/13/2008

 14,Economics,5,22,T,D,01/14/2008

 15,Psychology,2,9,T,D,02/13/2008

 16,Finance,2,5,TT,D,01/16/2008

 17,Accounting,4,3,TT,D,01/01/2007

 18,Biological Sciences,3,6,NT,M,01/31/2008

 19,Psychology,5,24,NT,D,02/19/2008

 20,Computer Science,4,16,T,D,02/20/2008

 21,Philosophy,4,19,T,D,03/24/2008

 22,History,5,6,PT,D,06/28/2007

 23,Sociology,2,4,TT,D,01/22/2007

 24,Physics,1,3,TT,D,01/24/2008

 25,Sociology,1,5,TT,D,07/05/2007

 26,Chemistry,5,10,NT,M,08/26/2007

 27,Justice Studies,1,13,T,D,08/17/2007

 28,Physics,5,4,PT,B,07/02/2007

 29,Special Education,3,11,T,D,01/29/2008

 30,Communication Studies,4,14,T,D,09/09/2007

 ;

run;

proc print;

 id Faculty_id;

run ;


output:

                                  The SAS System

faculty_ID Department Satisfaction_with_Department Years_Employed_at_University Status Degree Date
1 Anthropology 5 20 T D 12FEB2007
2 Family and Consumer Studies 4 15 NT M 18MAR2007
3 Communication Studies 2 5 NT M 05MAY2008
4 Speech Pathology and Audiology 5 5 PT M 24NOV2007
5 Nursing 2 22 T D 06SEP2007
6 English 5 27 T D 25APR2007
7 Nursing 3 13 NT M 16OCT2007
8 Economics 2 8 NT M 08JAN2008
9 History 4 5 PT B 09JAN2007
10 Finance 3 7 T D 10JAN2008
11 Mathematical Studies 5 16 T D 11JUN2008
12 Accounting 4 18 T D 18MAY2008
13 Psychology 2 9 T D 13FEB2008
14 Economics 5 22 T D 14JAN2008
15 Psychology 2 9 T D 13FEB2008
16 Finance 2 5 TT D 16JAN2008
17 Accounting 4 3 TT D 01JAN2007
18 Biological Sciences 3 6 NT M 31JAN2008
19 Psychology 5 24 NT D 19FEB2008
20 Computer Science 4 16 T D 20FEB2008
21 Philosophy 4 19 T D 24MAR2008
22 History 5 6 PT D 28JUN2007
23 Sociology 2 4 TT D 22JAN2007
24 Physics 1 3 TT D 24JAN2008
25 Sociology 1 5 TT D 05JUL2007
26 Chemistry 5 10 NT M 26AUG2007
27 Justice Studies 1 13 T D 17AUG2007
28 Physics 5 4 PT B 02JUL2007
29 Special Education 3 11 T D 29JAN2008
30 Communication Studies 4 14 T D 09SEP2007

data work.tutor;

 set tutor;

 if Satisfaction_with_Department=5 then output;

run;

proc print;

run;


output:

                                                      The SAS System

Obs faculty_ID Department Satisfaction_with_Department Years_Employed_at_University Status Degree Date
1 1 Anthropology 5 20 T D 12FEB2007
2 4 Speech Pathology and Audiology 5 5 PT M 24NOV2007
3 6 English 5 27 T D 25APR2007
4 11 Mathematical Studies 5 16 T D 11JUN2008
5 14 Economics 5 22 T D 14JAN2008
6 19 Psychology 5 24 NT D 19FEB2008
7 22 History 5 6 PT D 28JUN2007
8 26 Chemistry 5 10 NT M 26AUG2007
9 28 Physics 5 4 PT B 02JUL2007


data work.tutor01;

 set tutor;

 if Degree='D' then output;

run;

proc print;

run;


output:
                                                          The SAS System

Obs faculty_ID Department Satisfaction_with_Department Years_Employed_at_University Status Degree Date
1 1 Anthropology 5 20 T D 12FEB2007
2 6 English 5 27 T D 25APR2007
3 11 Mathematical Studies 5 16 T D 11JUN2008
4 14 Economics 5 22 T D 14JAN2008
5 19 Psychology 5 24 NT D 19FEB2008
6 22 History 5 6 PT D 28JUN2007


TRY AND COMMENT YOUR CODE...

-->PLEASE READ AND COMMENT THE BLOG...

--PLEASE FOLLOW THE BLOG FOR MORE UPDATES...

--FOLLOW US IN FACEBOOK SASALL4YOU AND JOIN ...

--JOIN US IN FACEBOOK AND TELEGRAM  CHANNEL FOR MORE UPDATES

   CLICK HERE : https://t.me/SasAll4You

Comments