Data:
Each record contains a varying number of values for Activity.
First Five Records
Raw Data File Excdata3
1---+----10---+----20---+----30---+----40
1051 TENNIS SWIMMING AEROBICS
1052 JOGGING BASKETBALL
1053 AEROBICS SWIMMING CYCLING
1054 GOLF JOGGING TENNIS
1055 WALKING AEROBICS
This is the code for the data below
data level_1;
infile excdata3 missover;
input id $ activity :$10.@;
choice=0;
do while (activity ne '');
choice+1;
output;
input activity :$10.@;
end;
run;
I would like the data displayed as
1051 Tennis 1
1051 swimming 2
1051 Areobics 3
1051 Jogging 1
so forth and so on...
1. I am beginner in sas and having a problem understanding the logic of the code (Is there anyway it can be explained in the log).Why is the output statement before the second input and not after the input statement.
2. For a do loop if the condition is true does the loop perform again or you go to the top of the data setp..Any help is appreciated..
Thanks,
Roland
Each record contains a varying number of values for Activity.
First Five Records
Raw Data File Excdata3
1---+----10---+----20---+----30---+----40
1051 TENNIS SWIMMING AEROBICS
1052 JOGGING BASKETBALL
1053 AEROBICS SWIMMING CYCLING
1054 GOLF JOGGING TENNIS
1055 WALKING AEROBICS
This is the code for the data below
data level_1;
infile excdata3 missover;
input id $ activity :$10.@;
choice=0;
do while (activity ne '');
choice+1;
output;
input activity :$10.@;
end;
run;
I would like the data displayed as
1051 Tennis 1
1051 swimming 2
1051 Areobics 3
1051 Jogging 1
so forth and so on...
1. I am beginner in sas and having a problem understanding the logic of the code (Is there anyway it can be explained in the log).Why is the output statement before the second input and not after the input statement.
2. For a do loop if the condition is true does the loop perform again or you go to the top of the data setp..Any help is appreciated..
Thanks,
Roland