/***************************************************************************************************************** SAS file name: if0thenset File location: _________________________________________________________________________________________________________________ Purpose: To demonstrate the purpose of the 'If 0 then set' statement in SAS Author: Peter Clemmensen Creation Date: 18/01/2019 This program supports the example page "The Meaning of If 0 Then Set in SAS Data Step" on SASnrd.com *****************************************************************************************************************/ /* Read variables into the PDV with the if 0 then set method */ data test1; if 0 then set sashelp.class; run; /* 0 means "FALSE". Therefore, this statement works the same way */ data test1; if (1=2) then set sashelp.class; run; /* Read variables into the PDV with a length statement */ data test2; length Age 8 Height 8 Name $8 Sex $1 Weight 8; run; /* Confirm that test1 and test2 are identical */ proc compare data=test1 comp=test2;run; /* Hash object application */ data wanthash(drop=rc); if 0 then set work.emphours; if _N_ = 1 then do; declare hash h(dataset:'work.emphours'); h.defineKey('empid'); h.defineData('hours', 'sickdays', 'seniority'); h.defineDone(); call missing(hours, sickdays, seniority); end; set Employees; rc=h.find(); run;