BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

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,
3 REPLIES 3
deleted_user
Not applicable
[pre]
%let LOW_VALUE = __________________ ; * fill in your low value ;
data outdata;
infile indata isam;
input var1 $ var2 ;
if var1 lt &LOW_VALUE then var1 = " ";
output;
run;
[/pre]

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.
deleted_user
Not applicable
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.
Cynthia_sas
SAS Super FREQ
Hi:
SAS does NOT have the same concept of HIGH-VALUES and LOW-VALUES as other languages like COBOL. For example, in this COBOL code snippet (from here: http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/apiref/exdqilecobol.htm
[pre]

*
* 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.

[/pre]

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):

[pre]

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.

[/pre]

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.

cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2478 views
  • 0 likes
  • 2 in conversation