1665 ***************************************; 1666 * f=prog_mbquest2.sas *; 1667 * *; 1668 * SAS code to answer the research- *; 1669 * oriented questions, using the *; 1670 * simulated MB Health data in a *; 1671 * program that creates the necessary *; 1672 * code in one data step. *; 1673 * This assumes the temporary SAS *; 1674 * set "test" has been created. *; 1675 * *; 1676 * NOTE: the "formchar" option in the *; 1677 * PROC FREQ statements were required *; 1678 * here to enable Web display of *; 1679 * tables - it is not normally needed. *; 1680 ***************************************; 1681 1682 %include 'c:\winnt\profiles\Ruth\personal\My SAS 1682! files\sasmanual\formats\fmts95.sas'; NOTE: Format $ABSTYPL is already on the library. NOTE: Format $ABSTYPL has been output. NOTE: Format $CHARL is already on the library. NOTE: Format $CHARL has been output. NOTE: Format $DISCREL is already on the library. NOTE: Format $DISCREL has been output. NOTE: Format $GENDERL is already on the library. NOTE: Format $GENDERL has been output. NOTE: Format $ICD17L is already on the library. NOTE: Format $ICD17L has been output. NOTE: Format $INCDRL is already on the library. NOTE: Format $INCDRL has been output. NOTE: Format $REGIONL is already on the library. NOTE: Format $REGIONL has been output. NOTE: Format $RISKL is already on the library. NOTE: Format $RISKL has been output. NOTE: Format $SCHEDL is already on the library. NOTE: Format $SCHEDL has been output. NOTE: Format $SEVRL is already on the library. NOTE: Format $SEVRL has been output. NOTE: Format $TREATYL is already on the library. NOTE: Format $TREATYL has been output. NOTE: Format $TRNADML is already on the library. NOTE: Format $TRNADML has been output. NOTE: Format $TRNDISL is already on the library. NOTE: Format $TRNDISL has been output. NOTE: Format $TYPEHL is already on the library. NOTE: Format $TYPEHL has been output. NOTE: Format $WBURGL is already on the library. NOTE: Format $WBURGL has been output. NOTE: PROCEDURE FORMAT used: real time 0.16 seconds cpu time 0.15 seconds 1775 1776 1777 data final; 1778 set test; 1779 1780 ****---Question 1-----****; 1781 1782 lensop = ('13 '<=op01<='1399'); /* Flag eye operations 1782! */ 1783 1784 *Another way of flagging the eye operations: *; 1785 1786 lensop2=substr(op01,1,2)='13'; 1787 1788 *(Question 2 does not need new variable code)*; 1789 1790 ****---Question 3----****; 1791 1792 if '820 '<=diag01<='82099' then hipfx=1; 1793 else if '820 '<=diag02<='82099' then hipfx=1; 1794 else hipfx=0; 1795 1796 *(Note that substring could be used instead. 1797 Also note that a DO loop, with an ARRAY, 1798 can be used for performing repetitive tasks 1799 such as the above and should be used when 1800 many fields need to be processed.) 1801 1802 *(Question 4 does not need new variable code)*; 1803 1804 ****---Question 5-----****; 1805 1806 deathall= (.