Professional Documents
Culture Documents
LoadCase Function
LoadCase Function
LoadCase Function
Format
b = loadcase(dictionary_name『,id1,...,idN』);
Description
The loadcase function reads a specified case from an external file into memory. Once the case is
loaded, all variables defined in the corresponding dictionary are available for use.
The dictionary name must be supplied and refers to an external dictionary associated with your
application.
The optional list of ID variables, id1 ... idN, specifies the list of variables that will identify the
case to load from the external file. This process is similar to matching files on the basis of key
variables in statistical and database software packages. Each of the variables in the list must be
defined in a dictionary or working storage. The combined length of the variables in the list must
equal the length of the case IDs defined for the external dictionary. The function concatenates the
variables in the ID list to form a string. It then loads from the external file the case whose case
identifier matches the string constructed from the list.
If no ID list is provided, the next logical case in the external file will be loaded. The next logical
case is defined as the case with the next sequential case identifier (in ascending order). This will
not necessarily be the next case in physical sequence in the file.
(In versions of CSPro prior to 7.0, calling this function would automatically open an external
file. The function no longer does this, so if you call close on an external dictionary, you must
open it manually before calling this function.)
Return Value
The function returns a logical value of 1 (true) if the case was loaded successfully and 0 (false)
otherwise.
Example
if loadcase(SAMPLE_DICT,CLUSTER,HH) then
WEIGHT = SAMPLE_WEIGHT;
endif;
See also: Retrieve Function, WriteCase Function
PROC A0
//;...........................
flag=0;
BLOCKID=A0;
flag=loadcase(sheet2_dict,BLOCKID);
if flag=0 then
endif;
cc=0;
if flag=1 then
if Month<>month1 then
else
cc=cc+1;
endif;
endif;
if flag=1 then
if SECTOR<>SECTOR1 then
else
cc=cc+1;
endif;
endif;
if flag=1 then
if DISTRICT<>DISTRICT1 then
else
cc=cc+1;
endif;
endif;
if flag=1 then
if DS<>DSCODE1 then
errmsg('DS Invalid. [ A0 = %05d ] [ Data file(DS) = %02d ] ***** [ Sample File(DS) = %02d ]
',A0,DS,DSCODE1);
else
cc=cc+1;
endif;
endif;
if flag=1 then
if PSU<>PSU1 then
errmsg('PSU Invalid. [ A0 = %05d ] [ Data file(PSU) = %02d ] ***** [ Sample File(PSU) = %02d ]
',A0,PSU,PSU1);
else
cc=cc+1;
endif;
endif;
// if cc=5 then
//
// endif;