Need to run this data on sas

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Need to run this data on sas

Hello,

I tried to run this code but I couldn't because of (161 - ERROR 161-185: No matching DO/SELECT statement)

can any one help me to fix it??

this is the code that I used

data infantsurvival;

do age=1 to 8;

do smoke=1 to 8;

do gestation=1 to 8;

do infantsurv=0 to 1 by -1;

input y @@;

output;

end;

end;

cards;

30 <30 <30 <30 30+ 30+ 30+ 30+ <5 <5 5+ 5+ <5 <5 5+ 5+ <260 >260 <260 >260 <260 >260 <260 >260 50 315 24 4012 9 40 6 459 41 147 14 1594 4 11 1 124

run;


Accepted Solutions
Solution
‎10-28-2014 01:55 PM
Respected Advisor
Posts: 3,799

Re: Need to run this data on sas

I could not open the pdf so I don't know about that.  Looking at your program I think this may be what you need.

proc format;
  
value age   1='<30'  2='30+';
  
value smoke 1='<5'   2='5+';
  
value gest  1='<260' 2='>260';
  
run;
data infantsurvival;
   do age=1 to 2;
     
do smoke=1 to 2;
        
do gestation=1 to 2;
           
do infantsurv=0 to 1;
              
input y $ @@;
               output;
              
end;
           
end;
        
end;
     
end;
  
cards;
50 315 24 4012 9 40 6 459 41 147 14 1594 4 11 1 124
;;;;
   run;
proc print;
  
format age age. smoke smoke. gest: gest.;
  
run;


/*<30 <30 <30 <30 30+ 30+ 30+ 30+ */
/*<5 <5  5+  5+  <5  <5  5+  5+ */
/*<260 >260 <260 >260 <260 >260 <260 >260 */


10-28-2014 12-54-46 PM.png

View solution in original post


All Replies
Solution
‎10-28-2014 01:55 PM
Respected Advisor
Posts: 3,799

Re: Need to run this data on sas

I could not open the pdf so I don't know about that.  Looking at your program I think this may be what you need.

proc format;
  
value age   1='<30'  2='30+';
  
value smoke 1='<5'   2='5+';
  
value gest  1='<260' 2='>260';
  
run;
data infantsurvival;
   do age=1 to 2;
     
do smoke=1 to 2;
        
do gestation=1 to 2;
           
do infantsurv=0 to 1;
              
input y $ @@;
               output;
              
end;
           
end;
        
end;
     
end;
  
cards;
50 315 24 4012 9 40 6 459 41 147 14 1594 4 11 1 124
;;;;
   run;
proc print;
  
format age age. smoke smoke. gest: gest.;
  
run;


/*<30 <30 <30 <30 30+ 30+ 30+ 30+ */
/*<5 <5  5+  5+  <5  <5  5+  5+ */
/*<260 >260 <260 >260 <260 >260 <260 >260 */


10-28-2014 12-54-46 PM.png
New Contributor
Posts: 2

Re: Need to run this data on sas

Posted in reply to data_null__

Hello ,

thanks you for your answer

I tried this code but it think there is a mistake , can you please take a look again at the file ( I already changed it from pdf to png format )

Thanks again Smiley Happy

Respected Advisor
Posts: 3,799

Re: Need to run this data on sas

I check my output against the attachment you posted.  Other than the fact that survival is in rows I can see no difference.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 249 views
  • 3 likes
  • 2 in conversation