My code has to read a IMS database and has to generate an extract file for that upon certain validation.
On which one of the field has low-values by default when there is no value to populate, in such case I have to replace them to spaces before I output to the extract file, other than that the actual value has to go for the extract.
I seek solution for my above requirement from experts.
Thanks in Advance,
%let LOW_VALUE = __________________ ; * fill in your low value ;
infile indata isam;
input var1 $ var2 ;
if var1 lt &LOW_VALUE then var1 = " ";
this sounds like it may be a homework assignment, as it is very basic SAS coding.
Have you read anything about how to program in SAS?
The online SAS Documentation is rather extensive, and fairly good/well written.
As I said in different post that I haven't read any books on SAS and not trained I work with what exists already in the system.
I found the answer using RANK function, thank you for taking time to provide me a solution.
* Initialize QCAPCMD options control block for CL processing
MOVE 0 TO COMMAND-PROCESS-TYPE.
MOVE "0" TO DBCS-DATA-HANDLING.
MOVE "0" TO PROMPTER-ACTION.
MOVE "0" TO COMMAND-STRING-SYNTAX.
MOVE SPACES TO MESSAGE-KEY.
MOVE LOW-VALUES TO RESERVED OF QCA-PCMD-CPOP0100.
This is how you initialize field values with COBOL -- essentially moving default values into the fields.
As I remember, HIGH-VALUES was all hex FF and LOW-Values was all 00. As a COBOL programmer,
it was easy to tell when you had "data" versus the "default" value because you could test for HIGH-VALUES
or LOW-VALUES, which would never come from the users because they were impossible to type into a screen.
COB2SAS is a SAS utility that we used to use to turn our COBOL copybooks into SAS INPUT statements, there's this note (in the documentation) http://support.sas.com/techsup/technote/ts620.html
about how to test for HIGH/LOW values (if you are getting INVALID data when you try to read a COBOL created file with SAS):
HIGH-VALUES or LOW-VALUES may be in your copybook. SAS doesn't have the concept of low or high values.
This should be easy to detect by looking in the hex dump in your SASLOG of the record being read.
If you do have high or low values in your data, one approach would be to read the field in as character
and test for '00'x and 'FF'x. If it's not, then use the INPUT function to convert it to the appropriate
numeric. Another approach would be to use the ? ? modifier on your INPUT statement
so that the 'INVALID DATA' messages aren't generated.
Are you using SAS/Access to IMS??? Not that it matters much. Tech Support or the documentation might be able to tell you whether there's another
option other than the test described above -- not that it's too hard, it would just be an IF statement.