Hi,
In my source data file, I have exactly 250000 lakhs records..Through infile statement ,we are reading the source data , then we are doing validation part ( created two temporary work dataset - one for error dataset and the other one is for target dataset) . Like the code as below
data work.RETAIL_CUST /* Drop the temporary columns from the target dataset */ (drop = X_INSURED_NAME X_ADDRESSOFINSURED) work.RETAIL_CUST_ERROR /* Drop the actual columns from the ERROR Dataset */ (drop = INSURED_NAME ADDRESSOFINSURED) ; infile 'C:\Official\RGIC\Data\retail_txt.txt' lrecl = 1024 delimiter = '|' dsd missover firstobs = 2; ;
/* Final Variables to be populated after the Structure Validation is done */ attrib TRAN_ID length = $7; attrib INSURED_NAME length = $30; attrib ADDRESSOFINSURED length = $200; attrib PRODUCT_CODE length = $12; attrib PRODUCT_NAME length = $30; attrib BRANCH_CODE length = $11; attrib BRANCH_NAME length = $50; attrib CONTACTMOBILE length = $20; attrib CONTACTLANDLINE length = $20; attrib EMAIL length = $50; attrib PREVIOUS_POLICY_NUMBER length = $30; attrib AGENT_CODE length = $20; attrib AGENT_BROKER_NAME length = $30; attrib PAN length = $15; attrib VEHICALNO length = $20; attrib ENGINENUMBER length = $30; attrib CHAISSENO length = $30; attrib DOB length = $12; attrib GENDER length = $6; attrib POLICYNO length = $30; attrib PASSPORT length = $20;
/* Temporary Variables to read the data from file */ attrib X_INSURED_NAME length = $300; attrib X_ADDRESSOFINSURED length = $300;
/* Note - The Input below reads the data into temporary columns of bigger size */ input TRAN_ID X_INSURED_NAME X_ADDRESSOFINSURED PRODUCT_CODE PRODUCT_NAME BRANCH_CODE BRANCH_NAME CONTACTMOBILE CONTACTLANDLINE EMAIL PREVIOUS_POLICY_NUMBER AGENT_CODE AGENT_BROKER_NAME PAN VEHICALNO ENGINENUMBER CHAISSENO DOB GENDER POLICYNO PASSPORT;
/* Apply the Structure Validation Rules on temporary columns */ ERR_REC = 0; if length(X_INSURED_NAME) > 30 then ERR_REC = 1; else INSURED_NAME = strip(X_INSURED_NAME);
if length(X_ADDRESSOFINSURED) > 200 then ERR_REC = 1; else ADDRESSOFINSURED = strip(X_ADDRESSOFINSURED);
/* Check the ERR_REC value */ if ERR_REC = 0 then output work.RETAIL_CUST; /* Output correct data in the target table */ else output work.RETAIL_CUST_ERROR; /* Output Error data in the ERROR table */
run;
The RETAIL_CUST dataset will have only the proper records and RETAIL_CUST_ERROR dataset will have only the error records.
But my requirement is to capture the source row count and populate into my final table. Is there any option to capture the source count( i.e 2500000) in a variable..
I know there is one approach..create a dataset for the infile statement t,hen taking the output count of the dataset using the proc sql, will give the source file count...But I dont want to create a extra dataset simply for reading the data from file.
Request to guide is there any way to assign some variable to retrieve the source count from the file in the same part of the code as above.
... View more