Help using Base SAS procedures

IF then output statement

Reply
Contributor
Posts: 31

IF then output statement

so i was wondering if it is possible to tell sas to give the values 13 4761 164 121091 113 98091 a1,t1,a2,t2,a3,t3 respectively. i want to use them to get E1 and E2 and some other variables. i wrote something but i know its not correct because it isn't running. what modifications do i have to make?

data persontime;                                                                                                                                                                                               

input OC $ cases personyears;                                                                                                                                                                                  

ID=cases/personyears;    

If OC='Current' then output cases=a1;                                                                                                                                                                      

If OC='Past' then output cases=a2; 

If OC='Never' then output cases=a3;

If OC='Current' then output personyears=t1;  

If OC='Past' then output personyears=t2;                                                                                                                                                                   

If OC='Never' then output personyears=t3;  

E1=ti/(t1+t2);

E2=t2/(t1+t2);

run;

datalines;                                                                                                                                                                                                     
Current 13 4761                                                                                                                                                                                                
Past 164 121091                                                                                                                                                                                                
Never 113 98091                                                                                                                                                                                                
run;                                                                                                                                                                                                           
proc print data=persontime;                                                                                                                                                                                    
run;                                                                                                                                                                                                           

thank you!

                                                                                                                                                                                              
                                                                                                                                                                          
                                                                                                                                                                            
                                                                                                                                                                 
                                                                                                                                                                   
                                                                                                                                                                                           
Ask a Question
Discussion stats
  • 0 replies
  • 153 views
  • 0 likes
  • 1 in conversation