/**********************************************************************/


libname mylib ' mydir ';
proc access dbms=oracle;
   create mylib.emp.access;   
   user=scott;                
   orapw=tiger;               
   table=emp;                 
   path='@2:512,buffsize=500';
run;                          


/**********************************************************************/


proc access dbms=oracle accdesc=mylib.emp;
   create mylib.emp_v.view;               
   select empno ename sal deptno;         
   subset where empno >= 7700;            
run;                                      


/**********************************************************************/


proc sql;                                        
   connect to oracle (user=scott password=tiger);
   execute (update emp set sal=1200.00           
            where empno=7369) by oracle;


/**********************************************************************/


update emp set sal=1200.00 where empno=7369;


/**********************************************************************/


execute (update emp set sal=&s_adjust 
         where empno=&enum) by oracle;


/**********************************************************************/


proc sql;                                        
   connect to oracle (user=scott password=tiger);
   create table mylib.newdata as                 
      select * from connection to oracle         
         (select * from emp);                    


/**********************************************************************/


data mylib.emp_v;                         
   modify mylib.emp_v mylib.newdata;      
   by empno;                              
   if _iorc_=%sysrc(_sok) then replace;   
   else if _iorc_=%sysrc(_dsenmr) then do;
      output;                             
      _error_=0;                          
   end;                                   
run;


/**********************************************************************/


----+----1----+----2----+----3----+----4
jones     41 male   76 212 2 0          
smith     43 male   73 190 3 2          
doe       35 female 70 130 1 2          


/**********************************************************************/


   /* used to read flat1 file                             */
data info;                                                  
   infile 'userid.sas.v6code(flat1)';                       
   input name $ 1-10                                        
         age    11-12                                       
         sex  $ 14-19                                       
         ht     21-22                                       
         wt     24-26                                       
         cars   28                                          
         chldrn 30;                                         
run;                                                        

/**********************************************************************/


   /* used to create raw data file                        */
data _null_;                                                
   file 'userid.flat(flatfile)' lrecl=36 blksize=36;        
   set info;                                                
   put name    $10.                                         
       age     ib4.                                         
       sex     $6.                                          
       ht      pib4.                                        
       wt      rb4.                                         
       cars    zd4.                                         
       chldrn  pd4.;                                        
run;


/**********************************************************************/


data read_raw;                         
   infile 'c:\bslash raw_file' recfm=u;
   input name    $ebcdic10.
         age     s370fib4. 
         sex     $ebcdic6. 
         ht      s370fpib4.
         wt      s370frb4. 
         cars    s370fzd4. 
         chldrn  s370fpd4.;
run;                       


/**********************************************************************/