Tags
SAS – SAMPLE PROGRAM
An input file is received from other system and the data available in the file is provided below.
COBOL,1959,GRACE HOPPER
DB2,1983,EDGAR CODD
CICS,1968,IBM
The SAS code provided below will read the input file and produce an output file which has data in the below format.
(Note: COLS provided below is just for your reference)
—-+—-1—-+—-2—-+
COBOL 1959 GRACE HOPPER
DB2 1983 EDGAR CODD
CICS 1968 IBM
The main motive was to introduce you to SAS. Even though the primary purpose for SAS is statistical analysis, when we have input data in not an orderly format, we can make use of SAS programming. The below program is just a sample on how we can use SAS, we can do even more with it.
//PS010 EXEC SASMSTRC
//SASINPUT DD DSN=INPUT.SAS.FILE,DISP=SHR
//SASOFILE DD DSN=OUTPUT.SAS.FILE,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(1,5),RLSE),
// DCB=(LRECL=80,BLKSIZE=0,RECFM=FB)
//SASLIST DD SYSOUT=*
//SYSIN DD *
*–START OF SAS CNTLCARD —————–
DATA LANG;
INFILE SASINPUT DSD;
INPUT NAME :$5. YEAR PERSON :$20.;
DATA _NULL_;
SET LANG;
FILE SASOFILE NOTITLE;
PUT NAME 1-5 YEAR 08-11 PERSON 14-30;
*–END OF SAS CNTLCARD —————–
The option DSD used in the INFILE statement assumes that the delimiter as comma by default.
——————————————————————————————————–
In United States, If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog
——————————————————————————————————–
You may also like to look at:
Working on Mainframes – Is Change to a different technology necessary |
Pingback: SORT – PARSE – READ EXCEL (CSV) FILE IN MAINFRAMES | F1 for Mainframe